Verify PDF Format Compliance
ImageGear can determine that a PDF document was created in compliance with either PDF/A or PDF/X standards. This compliance check does not change the original PDF document; it just analyzes the content of a PDF document and reports violations.
PDF annotations can only be verified while they reside in a PDF document. Loading PDF annotations to ART will detach them from the PDF document and make them unavailable for PDF/A or PDF/X compliance validation.
First, create a preflight object with the IG_PDF_preflight_create function.
Next, validate the PDF document using the IG_PDF_preflight_verify_compliance function, indicating the target ISO PDF standard with an enumIGPDFPreflightProfile value. Successful completion produces a preflight report, accessed with the returned HIG_PDF_PREFLIGHT_REPORT handle.
Retrieve the preflight report code using the IG_PDF_preflight_report_get_code function. Optionally, retrieve the preflight report description using the IG_PDF_preflight_report_get_description function as follows:
When a PDF is determined compliant to the chosen preflight profile, preflight report code equals IG_PDF_PREFLIGHT_SUCCESS. Refer to enumIGPDFPreflightReportCodes for other possible report codes.
Finally, release the preflight object using the IG_PDF_preflight_delete function.
The following example illustrates how a PDF document can be verified for compliance with PDF/A-1b:2005:
To detail specific preflight noncompliance, if any, traverse the preflight report. The preflight report is organized as a tree of records. Starting with the first HIG_PDF_PREFLIGHT_REPORT returned from the IG_PDF_preflight_verify_compliance function, determine its child count using the IG_PDF_preflight_report_get_record_count function. Use the IG_PDF_preflight_report_get_record function to retrieve each of its child HIG_PDF_PREFLIGHT_REPORT handles. Repeat this sequence with each child handle retrieved.
The following example illustrates how to print a compliance report to stdout: