Link to home
Start Free TrialLog in
Avatar of Steve Marshall
Steve MarshallFlag for United Kingdom of Great Britain and Northern Ireland

asked on

PDF File Parsing - Page Setup Retrieval (and Manipulation)

I was wondering if anyone knows of a method using VB.Net that means that a large library (1000's of PDF files) of PDF files can be opened and parsed prgrammatically to extract the current Page Settings (primarily the Paper/Page Size) ??

We have a large number of files that have been generated out of CAD software and sometimes they have been reformatted to A4 paper size, and sometimes not (sometimes printing to paper 65" square!!). When these latter files are sent to the printer (an HP Printer in this case) the printer does not cope at all well with the paper-size and just errors the job and blocks the print queue.

What I would like to do is to programmatically run through the entire library and extract the page size and generate an excel spreadsheet (this last bit is easy once I have the details from the PDF!) that gives the document name and the page size setting.

Ideally I would like to be able to manipulate the page size to be A4 also, but this last step is not critical.

Any help/suggestions would be appreciated.

Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve Marshall


Thanks Robberbaron. I will give this a try and report back.

This has solved the initial dilemma. I have now generated a CSV of all PDF files that have one or other dimension (caters with page orientation as well) that exceeds A4. JUst need to work out the next step now, and PDFSharp may wee be able to deal with this as well.

Only issue is the popup message about a non-parseable Acrobat 6 iRef .... whatever that is!

see  for a known issue & a workaround...

i borrowed a method that uses a different PDF class (iTextSharp) to create bypass method in c#.
you need to find the old open-source version of iTextSharp.

check the bottom of the thread.
Thanks Robberbaron. Will look into this. My ultimate aim is to have a function available within my application that pre-checks any PDF before printing to ensure that the page settings are suitable and to then auto-scale if necessary before printing.

Thanks again,