<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Xpdf - PDFinfo - Command Line Utility to Retrieve Page Count and Other Information from PDF Files

Posted on
16,248 Points
948 Views
3 Endorsements
Last Modified:
Approved
Experience Level: Intermediate
5:09
Joe Winograd, Fellow&MVE
50+ years in computer industry. Everything from development to sales. CIO. Document imaging. EE MVE 2015, EE MVE 2016, EE FELLOW 2017.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF file's Info Dictionary, as well as some other information (metadata), including the page count. We show how to isolate the page count in a plain text file, and the same method may be used to isolate other metadata fields, such as the Author and PDF Producer. PDFinfo provides a command line interface, making it suitable for use in batch files, programs, and scripts — any place where a command line call can be made.

Video Steps

1. Download the software.


You may have already downloaded and unzipped the Xpdf tools while watching the first video in the Xpdf series, but if you haven't, then visit the Xpdf website. Click the Download link and then click the pre-compiled Windows binary ZIP archive to download the utilities for Windows.

Step1

2. Locate the documentation folder for the Xpdf utilities.


Go to the folder where you unzipped the downloaded ZIP file and find the <doc> folder.

Step2

3. Read the documentation for the PDFinfo tool.


Go into the <doc> folder and find the plain text file called <pdfinfo.txt>.

Open it with any text editor, such as Notepad, and read it. This is the documentation for the PDFinfo tool.

Step3

4. Set up a test folder.


Create a test folder.

Copy <pdfinfo.exe> from the unzipped <bin32> folder into your test folder.

Copy a sample PDF file into your test folder (in the video and the screenshots below, the file is called test.pdf, which is a PDF file created from my EE article, Windows 10 uses YOUR computer to help distribute itself).

Step4

5. Set up a command prompt for testing.


Open a command prompt window.

Navigate to your test folder.

Issue a DIR command in the command prompt to be sure that only two files are in it - the PDFinfo executable and the sample PDF file.

Step5

6. Run the PDFinfo utility on the sample PDF file.


In the command prompt window, enter the following command:

pdfinfo test.pdf

View the output in the command prompt.

Step6

7. Run PDFinfo again, this time piping the output to the FIND filter and then redirecting the output to a text file.


In the command prompt window, enter the following command:

pdfinfo test.pdf|find "Pages:">numpages.txt

Step7

8. Verify that the text file that was created.


Issue a DIR command in the command prompt to show that the text file was created.

Step8

9. View the text file that was created.


Open the text file with whatever text editor you prefer, such as Notepad or WordPad, and you'll see one line in there with the page count.

Step9
That's it! If you find this video to be helpful, please click the thumbs-up icon below. Thank you for watching!
3
Comment
0 Comments

Featured Post

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Join & Write a Comment

This article discusses and shows how to use some of the excellent features in a Freeware app called "IrfanView" that (going by questions I've received) many people seem to overlook or just don't know about. Enjoy...
Know the step by step procedures to split secured PDF documents. Also, learn a simple technique to remove passwords from protected PDF documents. This blog provides two ideal solutions that help users to split password protected PDF files.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month