Getting Document Information
Introduction
This chapter explains how to retrieve basic information about a PDF document. The information is similar to that found with Adobe Acrobat’s Document Properties feature with some added statistics.
You will learn how to:
- Obtain an overall snapshot of the document (-summary option) — Reports Document Information Properties (Title, Author etc.), total number for bookmarks, annotation information and font properties
- Retrieve document description information (-info option) — Reports Document Information Properties such as PDF version, number of pages, whether the file is encrypted or not and several other options
- Get font information (-font option) — Lists the names of fonts, type and whether the fonts are embedded or not in the file
- Get multiple types of information in the same report (-font, -info options) — An example of running multiple options. This example lists all the font properties as well as the PDF version, number of pages etc. in the document
Obtaining an Overall Snapshot of the Document
To obtain a summary of information about a PDF document, submit the apgetinfo command with the document’s file name and the -summary option. You will receive a listing that includes information about the following:
- Document description
- Bookmarks
- Annotations
- Fonts
Command
$apgetinfo -summary pathname\ApUtilsSample.pdf
Tip! The -summary option is the default, so you don’t have to include it.
Windows Example
$apgetinfo C:\Appligent\APGetInfo\samples\ApUtilsSample.pdf
UNIX/Macintosh Example
$./apgetinfo /Appligent/APGetInfo/samples/ApUtilsSample.pdf
Result
The figure below shows the results of running apgetinfo with no options (or with the -summary option) on the ApUtilsSample.pdf file in a default Windows installation.
Retrieving Document Description Information
To see document description information for a PDF file, use the -info option when you submit the apgetinfo command. Document description information includes data that identifies a file, such as its title and creation date. In Adobe Acrobat and Adobe Reader, most of this information can be viewed on the Description panel of the Document Properties dialog box.
Command
$apgetinfo -info inPDFFile
Windows Example
$apgetinfo -info C:\Appligent\APGetInfo\samples\ApUtilsSample.pdf
UNIX/Macintosh Example
$./apgetinfo -info /Appligent/APGetInfo/samples/ApUtilsSample.pdf
Result
The figure below shows the results of running apgetinfo with the -info option on the ApUtilsSample.pdf file. The order of information (Title, Creator, Author, etc.) may vary from document to document, depending on how it was created.
Getting Font Information
To get information about the fonts in a PDF document, use the -font option with the apgetinfo command. The information displayed includes:
- The names of each font used in the document
- The font type (for example, Type 1, Base 14)
- Whether or not the font is embedded in the document
Command
$apgetinfo -font inPDFFile
Windows Example
$apgetinfo -font C:\Appligent\APGetInfo\samples\ApUtilsSample.pdf
UNIX/Macintosh Example
$./apgetinfo -font /Appligent/APGetInfo/samples/ApUtilsSample.pdf
Result
The figure below shows the results of running apgetinfo with the -font option on the ApUtilsSample.pdf file.
Getting Multiple Types of Document Information
You can list multiple types of document information by using a combination of options.
Command
$apgetinfo [document information options] inPDFFile
Windows Example
$apgetinfo -info -font C:\Appligent\APGetInfo\samples\ApUtilsSample.pdf
UNIX/Macintosh Example
$./apgetinfo -info -font /Appligent/APGetInfo/samples/ApUtilsSample.pdf
Result
The figure below shows the results of running apgetinfo with the -info and -font options on the ApUtilsSample.pdf file.