I am looking for a simple free component where I can generate a given pdf file Thumbnail.
I have looked into PDFBox
, GhostScript
and Abobe 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. Is there a free simple component for Win-forms ?
i looked at http://tallcomponents.net/ PDF Thumbnailing component as well, apprently its only for Web
Thanks in advance.
Take a look at PDFLibNet . It is a single DLL that you can use to view PDFs. 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. 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/). 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. http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm
I have created project on SourceForge.net. I have used Windows API so you don't need any Adobe Pro:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.