?
Solved

Getting PDF page counts in Delphi

Posted on 2007-07-26
5
Medium Priority
?
559 Views
Last Modified: 2013-11-23
Hello All,
I need to write a quickie Delphi service to check a specified directory for Adobe PDF files, and return their page counts.  In other words, if a directory has 70 PDF files in it, How many pages are in these files?.  I want to avoid opening each file if possible, as this will be a real performance hit.  I am developing on Delphi 2007, and the results will be stored in a DB table.

Thanks,
Casey
0
Comment
Question by:Bianca
  • 3
  • 2
5 Comments
 
LVL 21

Expert Comment

by:developmentguru
ID: 19576708
I suspect that you will need to use Delphi's ability to import components (ActiveX) and import the type library for the adobe software.  If you can find / figure out how to do it yourself it will still involve openening the PDF.  To make matters worse, not all PDFs have a predetermined page count.  Some are data aware and expand to show all of the data.  I'm afraid there probably is no "quickie" for this one.  I hope the information helps to at least point you in the right direction.
0
 

Author Comment

by:Bianca
ID: 19576766
Well, I've already imported the Adobe ActiveX control (TPdf).  This doesn't get me any closer.  It basically creates and instance of adobe PDF view inside my form (you even get the adobe splash screen when opening a file).  I know that there are command line utilities and such out there that have this ability, I'm simply trying to find something similar that I can either build or add to an existing project in the form of a component.  I took a long look at the Tpdf activex control, but didn't see any obvious properties or meathods at getting to the page count.  Also, the Tpdf component is a visual component, and can't be used in a data module or service app.  I'm trying to find something that I can use in a service application.

Thanks,
0
 
LVL 21

Accepted Solution

by:
developmentguru earned 2000 total points
ID: 19576875
Check this out (no promises)
http://angusj.com/delphitips/pdfpagecount.php
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 19576888
(keep in mind that will only work for static PDFs)
0
 

Author Comment

by:Bianca
ID: 19577432
This is EXACTLY what I was looking for.  Great find thanks a lot!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
Have you ever come up with a need of emailing only few pages of PDF file to one of yourfriend or colleague, instead of whole Adobe file? If yes, then surely you have face problems in doing that! Read this section as I have suggested multiple solutio…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question