Hello guys,
Can anyone point me to a .net library that is capable of exporting a PDF document to a set of images, where each image represents a page from the original PDF file.
Any suggestions would be highly appreciated!
Best Regards, K
Hello guys,
Can anyone point me to a .net library that is capable of exporting a PDF document to a set of images, where each image represents a page from the original PDF file.
Any suggestions would be highly appreciated!
Best Regards, K
Look at http://sourceforge.net/search/?type%5Fof%5Fsearch=soft&words=PDF+CONVERTER
In particular look at
http://sourceforge.net/projects/conversio/ http://sourceforge.net/projects/qpdf2swf/ http://sourceforge.net/projects/pdfsharp/ PDFsharp is a .NET library for creating and modifying Adobe PDF documents programmatically from any .NET language like C# or VB.NET. PDFsharp defines classes for the objects found in PDF files, so you never have to deal with IDs or references directly. http://www.codeproject.com/showcase/pdfrasterizer.asp
Here is an article that explains about this, however note that it uses the GhostScript API: http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
After evaluation several free libraries (some of them mentioned in the other answers) and several demo versions of commercial libraries, we ended up using TallComponents PDFRasterizer.NET.
The rendered images look exactly like the PDFs displayed in a reader, and the API integrates well with System.Drawing, which is nice because it allows you to do any kind of transformation to the ouput before serializing the image file to disk/network:
public ThumbnailGenerator(FileInfo pdfFile)
{
using (var pdfStream = pdfFile.OpenRead())
{
var doc = new Document(pdfStream);
var page = doc.Pages[0];
using (var image = new Bitmap((int)page.Width, (int)page.Height))
using (var gfx = Graphics.FromImage(image))
{
page.Draw(gfx);
AddSuperFancyReflectionEffect(gfx);
image.Save(fileName, ImageFormat.Png);
}
}
}
Live sample: all cover images on Bookboon.com is generated using code similar to what is shown above.