Page Elements
Page Geometry
Each Page exposes its geometry through box properties:
getMediaBox()— the full page boundarygetCropBox()— the visible areagetRotate()— page rotation in degrees (0, 90, 180, or 270)
try (Document doc = new Document("input.pdf")) {
Page page = doc.getPages().get(1);
double width = page.getMediaBox().getWidth();
double height = page.getMediaBox().getHeight();
}Artifacts
The Artifact class models page decorations: headers, footers, watermarks, and
background images. Artifacts are non-content elements defined in the PDF specification.
Page page = doc.getPages().get(1);
for (Artifact artifact : page.getArtifacts()) {
System.out.println(artifact.getArtifactType());
}Embedded Files
EmbeddedFileCollection, accessible via Document.getEmbeddedFiles(), manages file
attachments embedded in the PDF document.
EmbeddedFileCollection files = doc.getEmbeddedFiles();
int count = files.size();