Generate Thumbnail Images from PDF Documents in .NET

Wrapping Up

Points of Interest

The Adobe Acrobat 5.0 SDK is not the greatest written documentation but most information is there if you dig a little.

If running under an NT service account the screen resolution and depth make a difference; for example if your server is only set for 256 colours in 640 x 480, and if the console application is run via the service it will not be able to render 24-bit colour thumbnails. I've seen the same effect when using charting controls from ASP, where the production IIS servers had low screen resolutions set and the colour-depth of the charts was low.

Also, if running in a batch on a server you should check the terms of the Acrobat license agreement to whether you are allowed to run the Adobe Acrobat application in a server-type process.

The images are about 2-3Kb in size and for about 3Gb of documents the thumbnails would take an additional 60MB - so storage requirements are not excessive. The actual time to generate thumbnails for thousands of documents would be a few hours, as Acrobat needs to load each document as well as the rendering to the clipboard, and the .NET bitmap scaling, etc.

References

  • Microsoft .NET Framework 1.1 documentation
  • Chris Sells' web site for the transparency example code
  • Adobe Acrobat 5.0 SDK documentation and examples
  • Code Complete Second Edition for the example PDF document (which I hope Steve doesn't mind me including and which I can totally recommend even nearly ten years since it was first published)

Conclusion

This article has shown how to manipulate PDF documents using the Acrobat SDK and combine images using the .NET framework.

At first it can be quite daunting trying to find good information on working with PDF documents programmatically, although there are now a number of good commercial components which hide a lot of the underlying postscript complexities.

I originally wrote this utility in Visual Basic 6 using a third-party imaging components, but now it is easier to share the code using the .NET framework. Especially as the complex imaging and manipulation can now be done with a few simple statements.

Thanks and I hope you enjoyed reading this article; I'd be interested to hear if people found it useful.

This article was originally published at http://www.codeproject.com/dotnet/pdfthumbnail.asp

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski