Posted by: Jeff Germain | December 22, 2009

Validating PDF Documents

So I’m just wrapping up a project where I had to generate PDF reports involving ArcGIS Server, ASP.NET MVC, and web services. I’ll do a post on how I rolled it all together later. But first, let’s look at this nugget… how to validate the PDFs being generated.

The PDF library I used was iTextSharp, which was great. I would suggest getting the book “iText In Action” if you’re short on time (here or at Amazon). Otherwise, you’ll be doing more trial and error than necessary. Another valuable resource is the outdated tutorials.

So, everything is working great on my dev box and on my server. However, my client was reporting this issue when attempting to open the report… they’re using Adobe Acrobat 8.1.6, while I’m using 9.0

“An Error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.”

Ouch! That doesn’t look good.

I wasn’t able to reproduce the issue using Adobe Reader or Foxit Reader. So I researched how to validate the PDF. iTextSharp doesn’t offer any way to do this, but the FREE trial version of Adobe Acrobat (9) does. It offers the program Preflight which can analyze your PDF in all sorts of ways. So I had my client send me a PDF they generated using our application which I analyzed using Preflight, specifically Report PDF syntax issues.

Preflight Run this gem, then save the results to a PDF. I sent those results to my client. Turns out it was their installation of Adobe Acrobat. Doh!

Preflight_Report

Anyways, a great tool and handy when generating PDFs using a low-level library like iTextSharp.

I had to download the Trial version of Adobe Acrobat 9.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: