IsTaggedPDF

Document properties, Accessibility

Description

Tests whether the selected document declares itself as a tagged PDF by checking the Catalog's /MarkInfo /Marked entry. A return value of 1 means the entry is present and set to true; any other state — entry absent, /Marked false, or no /MarkInfo dictionary — returns 0.

Syntax

Delphi

function TPDFlib.IsTaggedPDF: Integer;

ActiveX

Function PDFlib::IsTaggedPDF As Long

DLL

int DLIsTaggedPDF(int InstanceID);

Return values

0The document is not declared as a tagged PDF (or no document is open).
1The document is declared as a tagged PDF (/MarkInfo /Marked true).

Remarks

This is a metadata check only — it inspects the Catalog declaration, not the actual structure tree. A document can carry /Marked true without having a usable structure tree (for example, after partial editing), and a structure tree can technically exist without /Marked true. Use this function for a quick metadata signal; for a deeper compliance verdict on the in-memory document, call GetPDFUADiagnostics, which inspects the structure tree, page tags, and required attributes.

The flag is set automatically by SetPDFUAMode, by SetPDFAMode with an a-level mode (1, 4, 6), and by an explicit call to SetMarkInfo(1).

Example

// Branch on whether the loaded document already declares tagged PDF
PDF.LoadFromFile('input.pdf', '');
if PDF.IsTaggedPDF = 1 then
  WriteLn('input.pdf is a tagged PDF — content can be re-flowed')
else
begin
  WriteLn('input.pdf is not tagged — adding tag declarations');
  PDF.SetMarkInfo(1);  // mark, then construct a structure tree
end;

See also

SetMarkInfo, SetPDFUAMode, SetPDFAMode, GetPDFUADiagnostics, BeginTag