Before optimizing a PDF file, it can be useful to audit the PDF to identify what objects are present in the PDF  (such as images, fonts, document info, bookmarks, links, content streams, etc…) and what significant is their size in the document. In v2017R1, jPDFOptimizer added an audit function to do just this.

// Load a document
PDFOptimizer pdfOptimize = new PDFOptimizer("C:\\test\\myfile.pdf", null);
 
// Audit the document
AuditResults auditResults = pdfOptimize.audit();
 
// Write the audit results to a file
FileOutputStream auditOut = new FileOutputStream("C:\\test\\myfile_audit.xml");
auditResults.writeXml(auditOut);
auditOut.flush();
auditOut.close();

Here is a sample xml audit results output:

Auditing a PDF allows to identify which objects takes up space within a PDF which can help decide what is the best option for reducing the file size.
Tagged: