【问题标题】:PDF how to take preview snapshot?PDF如何拍摄预览快照?
【发布时间】:2011-02-07 01:57:25
【问题描述】:

当用户上传PDF文档或ms word文档时,我想对第一页进行快照并显示为图像,我该怎么做?

【问题讨论】:

    标签: c# asp.net pdf doc


    【解决方案1】:

    试试这篇文章:How To Convert PDF To Image Formats In .NET。它展示了如何使用我们的产品 PDFOne .NET 创建 PDF 页面的快照。

    免责声明:我为 Gnostice 工作。

    【讨论】:

      【解决方案2】:

      使用ImageMagick Application Wrapper,并且
      convert.exe 'file.pdf[0]' snapshot.jpg

      【讨论】:

        【解决方案3】:

        对于 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 开发过这个组件)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-02-13
          • 2015-01-13
          • 2011-09-09
          • 2014-05-23
          • 2013-02-14
          • 2014-12-03
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多