Get Page Information
Contents
[
Hide
]
Get page information
This example reads the main geometric properties of page 1.
Steps
- Create a
PdfFileInfoobject for the source PDF. - Call
getPageWidth,getPageHeight, andgetPageRotationfor the page you want to inspect. - Use or print the returned values.
- Close the
PdfFileInfoinstance.
Java example
public static void getPageInformation(Path inputFile) {
PdfFileInfo pdfInfo = new PdfFileInfo(inputFile.toString());
System.out.println("Page Width: " + pdfInfo.getPageWidth(1));
System.out.println("Page Height: " + pdfInfo.getPageHeight(1));
System.out.println("Page Rotation: " + pdfInfo.getPageRotation(1));
pdfInfo.close();
}