简体   繁体   English

在WinForms中创建PDF缩略图C#

[英]Create PDF Thumbnail C# in WinForms

I am looking for a simple free component where I can generate a given pdf file Thumbnail. 我正在寻找一个简单的免费组件,可以在其中生成给定的pdf文件Thumbnail。

I have looked into PDFBox , GhostScript and Abobe Interop . 我研究了PDFBoxGhostScriptAbobe Interop GhostScript is too heavy to deploy (too many files) and Abobe Interop requires Acrobat Pro 7 or later installed otherwise COM exception and PDFBox rendering functions still not implemented. GhostScript太重而无法部署(文件太多),并且Abobe Interop需要安装Acrobat Pro 7或更高版本,否则COM异常和PDFBox呈现功能仍未实现。 Is there a free simple component for Win-forms ? Win-forms是否有免费的简单组件?

i looked at http://tallcomponents.net/ PDF Thumbnailing component as well, apprently its only for Web 我也查看了http://tallcomponents.net/ PDF缩略图组件,仅适用于Web

Thanks in advance. 提前致谢。

Take a look at PDFLibNet . 看一下PDFLibNet It is a single DLL that you can use to view PDFs. 它是一个可用于查看PDF的DLL。 You can use it to generate preview images for each page like this: 您可以使用它为每个页面生成预览图像,如下所示:

Image RenderPage(PDFLibNet.PDFWrapper doc, int page)
{
    doc.CurrentPage = page + 1;
    doc.CurrentX = 0;
    doc.CurrentY = 0;

    using (var box = new PictureBox())
    {
        // have to give the document a handle to render into
        doc.RenderPage(box.Handle);

        // create an image to draw the page into
        var buffer = new Bitmap(doc.PageWidth, doc.PageHeight);
        doc.ClientBounds = new Rectangle(0, 0, doc.PageWidth, doc.PageHeight);
        using (var g = Graphics.FromImage(buffer))
        {
            var hdc = g.GetHdc();
            try
            {
                doc.DrawPageHDC(hdc);
            }
            finally
            {
                g.ReleaseHdc();
            }
        }

        return buffer;
    }
}

We were looking for a similar solution - create an image "thumbnail" from a pdf. 我们正在寻找一种类似的解决方案-从pdf创建图像“缩略图”。 In our search we looked at all the ones above but they all had their own issues and complications. 在搜索中,我们查看了以上所有内容,但它们都有自己的问题和复杂性。

We stumbled onto abcPDF (http://www.websupergoo.com/). 我们偶然发现了abcPDF(http://www.websupergoo.com/)。 This product has it all and it was simple and easy to use. 该产品具有全部功能,并且简单易用。 Here is a deep link to their documentation about creating a PNG from a PDF. 这是他们有关从PDF创建PNG的文档的深层链接。 http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm

I have created project on SourceForge.net. 我已经在SourceForge.net上创建了项目。 I have used Windows API so you don't need any Adobe Pro: 我已使用Windows API,因此您不需要任何Adobe Pro:

PDF Thumbnail Generator . PDF缩略图生成器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM