Detecting the version of a PDF document The following sample of code will help you to detect the PDF version a loaded document and extract some additional file Format inFormation.
Load a PDF document Extract the root metadata package Use the getPdfType method to obtain file Format inFormation advanced_usage.managing_metadata_for_specific_Formats.document.pdf.PdfReadFileFormatProperties
try (Metadata metadata = new Metadata(Constants.InputPdf)) { PdfRootPackage root = metadata.getRootPackageGeneric(); System.out.println(root.getPdfType().getFileFormat()); System.out.println(root.getPdfType().getVersion()); System.out.println(root.getPdfType().getMimeType()); System.out.println(root.getPdfType().getExtension()); } Reading built-in metadata properties To access built-in metadata of a PDF document, please use the getDocumentProperties method defined in the DocumentRootPackage class....with a document, extract form fields, attachments, bookmarks,...null ) { for ( PdfFormField field : root . getInspectionPackage...