Get Page Offset
Contents
[
Hide
]
Get page offset
Use this workflow when you need to understand how page content is positioned relative to the PDF origin.
Steps
- Create a
PdfFileInfoobject for the input PDF. - Call
getPageXOffsetandgetPageYOffsetfor the target page. - Convert the point values to inches by dividing by
72.0. - Use or print the converted values.
- Close the
PdfFileInfoinstance.
Java example
public static void getPageOffsets(Path inputFile) {
PdfFileInfo pdfInfo = new PdfFileInfo(inputFile.toString());
System.out.println("Page X Offset: " + (pdfInfo.getPageXOffset(1) / 72.0) + " inches");
System.out.println("Page Y Offset: " + (pdfInfo.getPageYOffset(1) / 72.0) + " inches");
pdfInfo.close();
}