开发者

how do I convert a pdf to a bitmap image in .net?

开发者 https://www.devze.com 2022-12-19 16:01 出处:网络
Looking for solution to convert a specified page of a pdf file to a bitmap imag开发者_如何学JAVAe.I did this in a previous project.We used ImageMagick.NET which isa wrapper of perhaps the greatest ope

Looking for solution to convert a specified page of a pdf file to a bitmap imag开发者_如何学JAVAe.


I did this in a previous project. We used ImageMagick.NET which is a wrapper of perhaps the greatest open source image manipulation API there is, ImageMagick

http://imagemagick.codeplex.com/


This might do the job:

http://www.o2sol.com/pdf4net/products.htm


Download PDFcreator from SourceForge. It is open source, and has COM automation component, sample code in a variety of languages. You can use the PDFcreator printer driver to save in a numerous graphics formats.


(Disclaimer I worked on this component at Software Siglo XXI)

If you don't want to mess with Ghostscript API and need a quick working solution to convert PDF documents to raster images (PNG, JPG, ...), you could use Super Pdf2Image Converter .NET. It's available for both 32 and 64 bit and is very cheap and effective.

You can take a look here: http://softwaresigloxxi.com/SuperPdf2ImageConverter.html

For instance, here's a sample code for converting:

// Instantiate the component
Pdf2ImageConverter p2i = new Pdf2ImageConverter(pdfPath);

// Get page count of a PDF file
int pages = p2i.GetPageCount();

// Get size of any page
int width, height;
p2i.GetPageSize(1, out width, out height);

// Convert any page of PDF to image file (preserving aspect ratio)
p2i.GetImage(outputImagePath, pageNumber, resolution, imageFormat);

// Or... convert any page of PDF to image (returns bitmap object)
Bitmap bm = p2i.GetImage(pageNumber, resolution, width, height, imageFormat);
0

精彩评论

暂无评论...
验证码 换一张
取 消