ConvertToPDFAEx
PDF/A
Requires the Enterprise edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibEnterprise (unit PDFlibEnterprise); the Enterprise DLL and ActiveX builds provide it unchanged; other editions keep the method, which returns 0, an empty string or False and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)
Description
Converts the selected document on a private snapshot with an explicit transparency fidelity policy and raster resolution
Syntax
Delphi
Function TPDFlib.ConvertToPDFAEx(TargetMode,FidelityPolicy,DPI: Integer): Integer; Virtual;
ActiveX
Function PDFlib::ConvertToPDFAEx(TargetMode As Long, FidelityPolicy As Long, DPI As Long) As Long
DLL
int DLConvertToPDFAEx(int InstanceID, int TargetMode, int FidelityPolicy, int DPI);
Parameters
| TargetMode | 1 through 11, using the numbering of SetPDFAMode |
|---|---|
| FidelityPolicy | 0: PDF_PDFA_FIDELITY_WHOLE_PAGE, use opaque whole-page compositing whenever required; 1: PDF_PDFA_FIDELITY_PREFER_REGIONS, try supported local regions before reporting and using whole-page fallback; 2: PDF_PDFA_FIDELITY_REGIONS_ONLY, reject a conversion requiring unsupported or whole-page compositing |
| DPI | 36 through 1200, the resolution used for any required region or whole-page composition |
Return values
| 1 | The private output passed the implemented finite checks, was saved and reopened, and replaced the selected document |
|---|---|
| 0 | Invalid arguments, unavailable required fidelity, cancellation, repair or validation failure; the original document and resource handles remain selected |
Regional transparency profile
PDF/A-1 forbids live transparency; policies 1 and 2 can composite bounded path fills and strokes, image soft masks, and bounded Form XObjects containing transparency, including isolated and knockout groups, while preserving unaffected original content
The finite profile requires unrotated pages with UserUnit 1, matching zero-origin media and crop boxes, no page-level group and no annotations; it accepts at most 100000 content instructions and 64 initial regions per page, merging touching regions into disjoint rectangles
Transparent paths use conservative transformed path and stroke bounds, intersected with known clipping bounds; transparent images and forms use their placed bounds, including form matrices and BBox clipping
Each region captures the final page appearance including its backdrop and later overlapping objects; the original content is clipped to the complement of these regions and opaque final-appearance images are drawn as artifacts, preserving paint order and clipping outside the replaced areas
Original text operators remain in the file, including text beneath regional images; glyphs inside a region are clipped and their visible appearance comes from pixels, so extraction can still contain that original text and semantic accessibility requires review
Transparent text or shading, Type 3 glyph painting, inline images, unresolved XObjects or graphics states, unknown or malformed operators, unsupported page geometry and full-page affected coverage require whole-page fallback under policy 1 and rejection under policy 2
PDF/A-2 and later parts retain permitted live transparency; a fidelity policy does not force unnecessary rasterization, although forbidden annotation opacity may still require whole-page conversion and therefore reject under policy 2
Reporting and adoption
GetPDFAConversionReport records the policy and DPI, each regional page and rectangle in PDF points, retained text-operator count, whole-page fallback reasons, unsupported resources and the final commit outcome
The existing repair pipeline and resource-handle adoption contract follow ConvertToPDFA; invalid arguments and conversion failures set LastErrorCode 409, other editions return 0 with LastErrorCode 900, and open authoring scopes retain their existing scope diagnostics
The regional strategy preserves the selected finite visual profile and does not certify arbitrary PDF rendering, color-profile reconciliation or accessibility semantics; every successful report retains fullCertification=false
DLL uses stdcall, macOS Dylib uses cdecl and the same integer arguments, and ActiveX exposes this method through IPDFlibrary17 and its default IDispatch; CoPDFlibrary.CreateArchivalTools returns the typed extension while all earlier interfaces remain available
Example
if PDF.ConvertToPDFAEx(2, PDF_PDFA_FIDELITY_PREFER_REGIONS, 300) = 1 then
PDF.SaveToFile('archival.pdf')
else
ShowMessage(PDF.GetPDFAConversionReport);
See also
ConvertToPDFA, GetPDFAConversionReport, FlattenTransparency, AutomationExtensions