SetPDFUAMode

Document properties, Accessibility

Description

Activates PDF/UA-1 (ISO 14289-1:2014) conformance mode for the selected document. This single call performs all document-level setup required by the standard: the document version is bumped to at least PDF 1.7, MarkInfo.Marked and MarkInfo.Suspects are written, DisplayDocTitle is enabled in ViewerPreferences, Catalog/Lang is set when a language is supplied, and the pdfuaid:part=1 XMP namespace entry is written. When the document is encrypted after SetPDFUAMode is active, CanCopyAccess (bit 10 of the encryption /P key) is automatically forced on regardless of the caller-supplied TPDFExtraPermissions mask, satisfying ISO 14289-1 §7.16. If the document was already encrypted before SetPDFUAMode was called, the existing encrypt dictionary is left unchanged — call Encrypt again after SetPDFUAMode to refresh the /P value. GetPDFUADiagnostics reports this situation as ENCRYPT-NO-ACCESS.

Call this before adding any content. Use BeginTag/EndTag and BeginArtifact/EndArtifact to tag the document content.

Syntax

Delphi

function TPDFlib.SetPDFUAMode(const Language: WideString): Integer;

ActiveX

Function PDFlib::SetPDFUAMode(Language As String) As Long

DLL

int DLSetPDFUAMode(int InstanceID, wchar_t* Language);
int DLSetPDFUAModeA(int InstanceID, char* Language);

Parameters

LanguageBCP 47 language tag for the document default language, e.g. "en-US", "de". Pass an empty string to omit the Catalog /Lang entry.

Return values

0Failed (no document is open)
1PDF/UA mode activated successfully

Remarks

At save time, all open pages automatically receive a /Tabs /S entry (structure-based tab order) when PDF/UA mode is active, satisfying ISO 14289-1 §7.18.3. Save-time fix-ups also auto-fill missing widget tooltips (/TU) and annotation /Contents entries, attach /AFRelationship to embedded files, strip any TrapNet annotations (forbidden by ISO 14289-1 §7.18.2), and attach /O = List /ListNumbering = None to any L structure element that lacks an explicit ListNumbering attribute (ISO 14289-1 §7.6).

See also: SetDocumentLanguage, SetMarkInfo, SetPDFAMode.