using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ConvertPDF;
namespace PDF2Img
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
PDFConvert convertor = new PDFConvert();
convertor.pdf2jpgTest();
Image img = Image.FromFile(@"C://tmp//pdfimg//out.jpg");
myBitmap = new Bitmap(img);
Graphics G = this.CreateGraphics();
GraphicsUnit GU = G.PageUnit;
BMPContainer = myBitmap.GetBounds(ref GU); //X,Y = 0
// Graphics g = this.CreateGraphics();
//g.DrawImage(myBitmap, 1, 1);
this.Invalidate();
}
private Bitmap myBitmap;
private RectangleF BMPContainer;
protected override void OnPaint(PaintEventArgs e)
{
Graphics G = e.Graphics;
if (myBitmap != null)
{
G.DrawImage(myBitmap, BMPContainer);
}
base.OnPaint(e);
}
}
}
pdf转换成jpg示例分享(2)
内容版权声明:除非注明,否则皆为本站原创文章。