AddRoleMap
Getagde PDF, toegankelijkheid
Beschrijving
Registreert een mapping van een custom structuurelement-typenaam naar een standaard PDF-structuurtype in de RoleMap-woordenboek van het document
Wanneer getagde PDF-inhoud niet-standaard tagnamen gebruikt (bijv. bedrijfsspecifieke of toepassingsspecifieke elementtypen), vereist de PDF-specificatie dat die namen in de root van de structuurboom worden toegewezen aan een standaard PDF-structuurtype in het /RoleMap-item. ISO 14289-1 §7.1 schrijft deze mapping voor voor alle PDF/UA-1-documenten met niet-standaard structuurelementtypen
Roep AddRoleMap één keer per custom type aan, vóórdat u BeginTag of BeginTagEx met dat type aanroept. Er kunnen meerdere mappings worden geregistreerd. Is hetzelfde custom type meer dan eens geregistreerd, dan wint de laatste mapping
De RoleMap wordt bij het opslaan van het document naar de structuurboomwortel geschreven, mits er ten minste één mapping is geregistreerd
Syntaxis
Delphi
Function TPDFlib.AddRoleMap(Const CustomType, StandardType: WideString): Integer;
ActiveX
Function PDFlib::AddRoleMap(CustomType As String, StandardType As String) As Long
DLL
int DLAddRoleMap(int InstanceID, const wchar_t* CustomType, const wchar_t* StandardType);
int DLAddRoleMapA(int InstanceID, const char* CustomType, const char* StandardType);
Parameters
| CustomType | De custom (niet-standaard) structuurelement-typenaam zoals gebruikt in BeginTag- of BeginTagEx-aanroepen, bijv. Headline, Caption, Callout |
|---|---|
| StandardType | Het standaard PDF-structuurtype waarnaar het custom type mapt: P, H1–H6, Figure, Table, Span, Link, Note, enz. (zie ISO 32000-1 §14.8.4). Dit moet een erkend standaardtype zijn, anders voldoet de mapping niet aan PDF/UA-conformiteitscheckers |
Retourwaarden
| 0 | Mislukt (er is geen document open) |
|---|---|
| 1 | Mapping met succes geregistreerd |
Voorbeeld
// Document with custom element types mapped to standard PDF structure types
PDF.SetPDFUAMode('en-US');
PDF.AddRoleMap('Headline', 'H1');
PDF.AddRoleMap('Subheadline', 'H2');
PDF.AddRoleMap('Caption', 'P');
PDF.BeginTag('Headline', '', '');
PDF.DrawText(50, 750, 'Annual Report 2026');
PDF.EndTag;
PDF.BeginTag('Subheadline', '', '');
PDF.DrawText(50, 720, 'Financial Highlights');
PDF.EndTag;