ConvertToPDFUA
PDF/UA
Description
Converts the selected document into an accessible or reusable tagged PDF conforming to PDF/UA-1, PDF/UA-2, or WTPDF 1.0, adopting the candidate only after verification
Syntax
Delphi
Function TPDFlib.ConvertToPDFUA(TargetMode: Integer; Const Language: WideString): Integer;Parameters
| TargetMode | 1 (PDF_PDFUA_TARGET_UA1) for PDF/UA-1; 2 (PDF_PDFUA_TARGET_UA2) for PDF/UA-2 (ISO 14289-2:2024); 3 (PDF_PDFUA_TARGET_WTPDF_REUSE) for WTPDF 1.0 Reuse; 4 (PDF_PDFUA_TARGET_WTPDF_ACCESSIBILITY) for WTPDF 1.0 Accessibility; 5 (PDF_PDFUA_TARGET_UA2_WTPDF) for combined PDF/UA-2 and WTPDF 1.0 Reuse & Accessibility |
|---|---|
| Language | BCP 47 natural language tag (such as en-US), or an empty string to retain an existing valid Catalog /Lang entry |
Return values
| 1 | The private candidate passed conversion and compliance checks and replaced the selected document |
|---|---|
| 0 | Arguments were invalid or a required precondition or compliance check failed; the original document is retained and GetPDFUAConversionReport lists every action and blocker |
Remarks
Untagged pages are automatically structured via AutoTagPages. When targeting PDF/UA-2 or WTPDF 1.0, legacy structure trees are migrated to a single PDF 2.0 standard structure namespace Document root, unnumbered H headings and legacy Note elements are upgraded to numbered Hn and FENote, intra-document outline and GoTo destinations receive structure destinations (/SD), missing fonts and /ToUnicode CMaps are repaired, and prohibited XFA or deprecated annotations are stripped.
Example
PDF.SetInformation(2, 'Annual Accessibility Report');
if PDF.ConvertToPDFUA(PDF_PDFUA_TARGET_UA2, 'en-US') = 1 then
PDF.SaveToFile('report-ua2.pdf')
else
ShowMessage(PDF.GetPDFUAConversionReport);See also
ConvertToPDFUAEx, GetPDFUAConversionReport, SetPDFUA2Mode, SetWTPDFMode, CheckFilePDFUACompliance