Avatar of anthonytr
anthonytrFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Count the number of Pages in a Tiff or PDF file

Is it possible to count the number of pages in a Tiff and/or PDF files in a dir?

I need to get the total pages from a collection of multipage tiff files or PDF files in a dir.

Thanks
Microsoft AccessProgrammingVB Script

Avatar of undefined
Last Comment
Joe Winograd
SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Blurred text
THIS SOLUTION IS 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
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Blurred text
THIS SOLUTION IS 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.
Avatar of anthonytr
anthonytr
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

I was hoping for something which could run from within my MS Access database and would be able to look at a Dir and calculate the page count all all tiff files in the Dir.

Perhaps i might have to rethink how i go about this.

Thanks for all your advice.
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

You're welcome. Sorry, I don't know enough about VBA in Access to help you with that approach. Regards, Joe
Avatar of anthonytr
anthonytr
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Hi, Thats ok.

I actually mis-read you answer.  I thought you were saying that what I was looking to do could NOT be done.  It's only when I re-read your answer that I realised you were actually saying the opposite.

I've been looking at the TiffTeller tool.  Using their command line tool, how would I call this from MS Access VBA?  They have the following example:

Usage: TiffTeller.exe <source> <destination> <options>
If you have path with spaces, use quotation marks.
 

Options:

-log <FileName> - Don`t show errors. Write them to the log file
-f - Export format
csv - Comma Separated Values, .csv (default)
dif - Data Interchange File Format, .dif
sylk - Symbolic Links Format, .slk
txt - Plain Text Format, .txt
-e - Show extensions
-r - Include suffolders
Note that -list is used when there is a list of files in a file.

Would it be possible to get the total page count back to my application?
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

> Would it be possible to get the total page count back to my application?

I haven't used the Tiff Teller command line call, but I have used both PDFtk and Xpdf's pdfinfo command line tools. All three of them work the same way — they put the information in a file. For example, PDFtk puts this line in a plain text file:

NumberOfPages: 3

Likewise, pdfinfo "prints" this line, among others (but it's easy to redirect to a plain text file):

Pages:          3

It seems that the Tiff Teller command line does something similar, even giving you a choice of output file format (csv, dif, sylk, txt), as well as providing an option for recursing into subfolders (-r). But at the end of the day, with all three of them, you'll need to read the files created and parse the output to extract the number of pages. I've done that many times with custom (stand-alone) programs, but I don't know to do it in VBA — I don't even know if it's possible to do in VBA. Regards, Joe
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo