THotPDF.AddStructureElement + PDF/UA accessibility attributes

THotPDF tagged-PDF surface (v2.119.36 / v2.119.40 / v2.119.41)

 

AddXFAPacket  Soporte AcroForm

THotPDF.AddStructureElement and Tagged PDF Helpers

Esta página documenta los helpers actuales de tagged-PDF y árbol de estructura PDF/UA de THotPDF. Los identificadores de código coinciden con las declaraciones públicas de Lib/HPDFDoc.pas

Current Delphi Surface

procedure SetStructureElementLanguage(Elem: THPDFDictionaryObject; const Lang: AnsiString);
procedure SetStructureElementExpansionText(Elem: THPDFDictionaryObject; const ExpansionText: AnsiString);
procedure SetStructureElementTitle(Elem: THPDFDictionaryObject; const Title: AnsiString);
procedure AddStructRoleMap(const SourceRole: AnsiString; const TargetRole: AnsiString);

function BeginTaggedContent(const Role: AnsiString; Parent: THPDFDictionaryObject;
  const Lang: AnsiString = ''; const Alt: AnsiString = '';
  const ActualText: AnsiString = ''; const ExpansionText: AnsiString = ''): THPDFDictionaryObject;
procedure EndTaggedContent;

function EmitTaggedHeading(Level: Integer; Parent: THPDFDictionaryObject; X, Y: Single; const Text: WideString): THPDFDictionaryObject;
function BeginTaggedList(Parent: THPDFDictionaryObject; const NumberingStyle: AnsiString = 'None'): THPDFDictionaryObject;
function EmitTaggedListItem(ListElem: THPDFDictionaryObject; LblX, LblY: Single; const LabelText: WideString; BodyX, BodyY: Single; const BodyText: WideString): THPDFDictionaryObject;
function BeginTaggedTable(Parent: THPDFDictionaryObject): THPDFDictionaryObject;
function AddTaggedTableRow(TableElem: THPDFDictionaryObject): THPDFDictionaryObject;
function EmitTaggedTableHeader(TRElem: THPDFDictionaryObject; X, Y: Single; const Text: WideString; const Scope: AnsiString): THPDFDictionaryObject;
function EmitTaggedTableCell(TRElem: THPDFDictionaryObject; X, Y: Single; const Text: WideString): THPDFDictionaryObject;
function BeginTaggedFigure(Parent: THPDFDictionaryObject; const AltText: AnsiString; const BBox: array of Single): THPDFDictionaryObject;
procedure EndTaggedFigure;
procedure RegisterAnnotForStructure(AnnotDict: THPDFDictionaryObject; StructElem: THPDFDictionaryObject);

function StandardStructureTypeToName(T: THPDFStandardStructureType): AnsiString;
function IsStandardStructureType(const Name: AnsiString): Boolean;

Structure Attributes and Role Mapping

SetStructureElementLanguage escribe una sustitución BCP-47 /Lang, SetStructureElementExpansionText escribe el texto de expansión /E, SetStructureElementTitle escribe el título legible /T y AddStructRoleMap mapea roles de estructura personalizados de vuelta a roles PDF estándar. StandardStructureTypeToName devuelve el nombre de rol PDF de un valor THPDFStandardStructureType, e IsStandardStructureType comprueba si un nombre de rol es estándar

High-Level Tagged Helpers

EmitTaggedHeading, BeginTaggedList, EmitTaggedListItem, BeginTaggedTable, AddTaggedTableRow, EmitTaggedTableHeader, EmitTaggedTableCell, BeginTaggedFigure, EndTaggedFigure y RegisterAnnotForStructure cubren el cableado común PDF/UA de encabezados, listas, tablas, figuras y anotaciones sin obligar a los llamadores a gestionar MCIDs manualmente

Typical Workflow

Active la salida tagged o PDFUACompliance, cree el elemento raíz de estructura, use la familia de helpers para emitir contenido semántico y cierre cada secuencia de contenido tagged o figura iniciada antes de EndDoc