April 2019
Beginner to intermediate
386 pages
11h 20m
English
A File object was created representing the PDFFile.pdf. The PDDocument class's static load method created an instance of PDDocument that holds the contents of the file. The close method was used to close the PDDocument once we were through with it:
File file = new File("PDFFile.pdf");PDDocument pdDocument = PDDocument.load(file);
The PDDocumentInformation represents the metadata for the PDF document. The getMetadataKeys method returns a set of keys for this information. In the for loop, we iterated through the set and displayed the corresponding key's values:
PDDocumentInformation pdDocumentInformation = pdDocument.getDocumentInformation();Set<String> metaDataKeys = pdDocumentInformation.getMetadataKeys();for (String key : metaDataKeys) ...
Read now
Unlock full access