I want to display thumbnails of the uploaded pdf files on my website(ASP.NET). So far I have done following things.
- From this link i got the idea to use ghostscript How to generate thumbnail for some pages of a PDF file?
You could probably use one of the general-purpose PDF libraries: • Ghostscript - C, available under the GPL • Poppler - C++, available under the GPL • Adobe PDF Library SDK - expensive Google reveals quite a few PDF-to-image converters which you may be able to incorporate if one of the above options doesn't work.
- Then Generate a pdf thumbnail (open source/free) told me to go look for that mentioned wrapper
Matthew Ephraim released an open source wrapper for Ghostscript that sounds like it does what you want and is in C#. Link to Source Code: https://github.com/mephraim/ghostscriptsharp Link to Blog Posting: http://www.mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/ You can make a simple call to the GeneratePageThumb method to generate a thumbnail (or use GeneratePageThumbs with a start and end page number to generate thumbnails for multiple seperate pages, with each page being a seperate output file), default file format is jpeg but you can change it, and many other options, by using the alternate GenerateOutput method call and specify options such as file format, page size, etc...
Now while following instructions of http://mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/ I have installed ghostscript on my system which is windows 8 64-bit.
Now I've created a solution containing the test project by above guy and in my own project i am calling a function of his project
try
{
GhostscriptSharpTests.GhostscriptSharpTests ss = new GhostscriptSharpTests.GhostscriptSharpTests();
ss.GenerateSinglePageThumbnail();
}
catch (Exception ex)
{
}
but I am getting an exception :
Unable to load DLL 'gsdll32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)