API referencePDF/A & Conformance

pdfAddRoleMap

Real tagged-PDF structure-tree mechanisms: /RoleMap

C
int32_t __stdcall pdfAddRoleMapA(PPDF IPDF, const char* CustomType, const char* StandardType);
BOOL32 __stdcall pdfAddRoleMapEntry(PPDF IPDF, const char* CustomTag, const char* StdTag);
BOOL32 __stdcall pdfAddClassMapEntry(PPDF IPDF, const char* ClassName, const char* Owner, const char* Key, const char* Val);
Delphi
function pdfAddRoleMapA(const IPDF: PPDF; CustomType, StandardType: PAnsiChar): Integer; stdcall;
function pdfAddRoleMapEntry(const IPDF: PPDF; const CustomTag, StdTag: PAnsiChar): LongBool; stdcall;
function pdfAddClassMapEntry(const IPDF: PPDF; const ClassName, Owner, Key, Val: PAnsiChar): LongBool; stdcall;

Purpose. Real tagged-PDF structure-tree mechanisms: /RoleMap custom-to-standard structure-type mapping (two ABI entry points — pdfAddRoleMap and pdfAddRoleMapEntry — over the same real AddRoleMapEntryH), and /ClassMap (custom class attribute definitions, via AddClassMapEntryH).

Description. All three narrow their string parameters via AnsiPtrToStr/AnsiString (system-codepage ANSI, no W-suffixed Unicode variant exists for pdfAddRoleMapEntry/pdfAddClassMapEntry despite pdfAddRoleMapA/W both existing as a pair — an asymmetry between the two role-map entry points). pdfAddClassMapEntry stores a 4-tuple (class name, owner, attribute key, value) — the /ClassMap mechanism lets multiple structure elements share a named attribute-set class rather than repeating attributes per-element.

Parameters.

ParameterDescription
IPDFDocument handle.
CustomType/CustomTagThe document's custom structure-type name.
StandardType/StdTagThe standard PDF structure type it maps to.
ClassName, Owner, Key, Val*(ClassMap only)* The class name, attribute owner namespace, key, and value.

Return value. True/non-zero on success.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfAddRoleMapW(IntPtr IPDF, IntPtr CustomType, IntPtr StandardType);
public static extern int pdfAddRoleMap(IntPtr IPDF, IntPtr CustomType, IntPtr StandardType);
public static extern int pdfAddRoleMapA(IntPtr IPDF, IntPtr CustomType, IntPtr StandardType);
Area
PDF/A & Conformance
Category

Content Creation

Exported names

pdfAddRoleMapW pdfAddRoleMap pdfAddRoleMapA

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.