我怎么转换PDF到一个位图图像在.net中?位图、图像、我怎么、net

2023-09-03 00:41:23 作者:戒烟戒酒不戒你

寻找解决方案,以PDF文件的指定页面转换为位图图像。

Looking for solution to convert a specified page of a pdf file to a bitmap image.

推荐答案

(声明我在软件二十一世纪制作该组件)的

如果你不想惹Ghostscript的API和需要快速有效的解决方案来转换PDF文档光栅图像(PNG,JPG,......),你可以使用超级Pdf2Image转换.NET 。它可用于32位和64位,是非常便宜和有效的。

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.

您可以到这里看看: http://softwaresigloxxi.com/SuperPdf2ImageConverter.html

例如,这里有一个样品code转换:

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);
 
精彩推荐
图片推荐