【发布时间】:2011-02-07 01:57:25
【问题描述】:
当用户上传PDF文档或ms word文档时,我想对第一页进行快照并显示为图像,我该怎么做?
【问题讨论】:
当用户上传PDF文档或ms word文档时,我想对第一页进行快照并显示为图像,我该怎么做?
【问题讨论】:
试试这篇文章:How To Convert PDF To Image Formats In .NET。它展示了如何使用我们的产品 PDFOne .NET 创建 PDF 页面的快照。
免责声明:我为 Gnostice 工作。
【讨论】:
使用ImageMagick Application Wrapper,并且
convert.exe 'file.pdf[0]' snapshot.jpg
【讨论】:
对于 Word 文档,您需要一个可以理解和呈现快照的解决方案。您可以使用 TxTextControl 或一些 Word 打印机驱动程序,例如 Easy PDF Creator。
准备好 PDF 文件后,您可以使用 Super Pdf2Image Converter .NET。它适用于 32 位和 64 位,并且非常便宜且有效。
你可以看这里:http://softwaresigloxxi.com/SuperPdf2ImageConverter.html
例如,下面是一个转换示例代码:
// 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);
(免责声明我曾在 Software Siglo XXI 开发过这个组件)
【讨论】: