Introduction

This chapter explains how to get information about the size and rotation of each page in a PDF document using the -pagesize option.

The figure below shows the first page of the ApUtilsSample.pdf file supplied with APGetInfo, along with its dimensions.

MediaBox and CropBox Example

The MediaBox is the full page size. APGetInfo supplies the coordinates of the MediaBox in points, measured from the bottom left of the page. The MediaBox in the figure above is 792 x 792 points. Its coordinates are: left=0, bottom=0, right=792, top=792.

The CropBox is the printable page area. It excludes any margins that have been cropped from the page. APGetInfo supplies the coordinates of the CropBox in points, measured from the bottom left of the page. The CropBox in the figure above is 612 x 792 points. Its coordinates are: left=90, bottom=0, right=702, top=792.

APGetInfo also retrieves page rotation information. For example, a PageRotate value of 0 indicates the page has not been rotated, while a value of 180 indicates a page rotated 180 degrees, or turned upside down. The PageRotate value of the figure above is 0.

Retrieving Page Size Information

To retrieve page size information for a PDF document, use the -pagesize option with the apgetinfo command.

Command

$apgetinfo -pagesize [other options] inPDFFile

Windows Example

$apgetinfo -pagesize C:\Appligent\APGetInfo\samples\ApUtilsSample.pdf

UNIX/Macintosh Example

$./apgetinfo -pagesize /Appligent/APGetInfo/samples/ApUtilsSample.pdf

Result

The figure below shows the results of running apgetinfo with the -pagesize option on the ApUtilsSample.pdf file supplied with APGetInfo. APGetInfo retrieves page size information from the document and sends it to the standard output device (STDOUT), the screen. Note how the MediaBox and CropBox values for page 1 compare with the dimensions of that page shown in the figure above.

*************Pagesize Information**************

===============================
Page : 1
MediaBox : left = 0.000, bottom = 0.000, right = 792.000, top = 792.000
CropBox : left = 90.000, bottom = 0.000, right = 702.000, top = 792.000
PageRotate : 0
===============================
Page : 2
MediaBox : left = 0.000, bottom = 0.000, right = 792.000, top = 792.000
CropBox : left = 90.000, bottom = 0.000, right = 702.000, top = 792.000
PageRotate : 0
===============================
Page : 3
MediaBox : left = 0.000, bottom = 0.000, right = 792.000, top = 792.000
CropBox : left = 90.000, bottom = 0.000, right = 702.000, top = 792.000
PageRotate : 0

***********************************************