Avatar of Steve Marshall
Steve Marshall
Flag 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.

Thanks,
Steve
Visual Basic.NET.NET ProgrammingAdobe Acrobat

Avatar of undefined
Last Comment
Steve Marshall

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robberbaron (robr)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Steve Marshall

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

Steve
Steve Marshall

ASKER
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!

Steve
Robberbaron (robr)

see http://forum.pdfsharp.net/viewtopic.php?f=2&t=693  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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Steve Marshall

ASKER
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,
Steve