SetAutoTagMode

Tagged PDF

Description

Turns on structure tagging that ordinary drawing calls carry by themselves.

Syntax

Delphi

Function TPDFlib.SetAutoTagMode(Mode: Integer): Integer;

Parameters

ModeA bit mask: 1 tags text, 2 marks page furniture as artifacts, 4 tags images as figures, 8 tags drawn tables, 15 does all four, 0 turns it off.

Return values

ModeThe mode that was in force before this call.
0Also returned when a negative mode is given, which is refused and leaves the mode unchanged.

Remarks

With text tagging on, text is tagged as a paragraph, and text drawn straight after RegisterHeading is tagged as a heading of that level. With furniture marking on, running headers and footers are marked as artifacts so a reader skips them instead of announcing the same line on every page.

With figure tagging on, a drawn image becomes a figure carrying the description left by RegisterFigure, or is drawn inside a layout artifact when RegisterDecoration said it carries no meaning.

With table tagging on, DrawTableRows carries the table, its rows and its cells into the structure tree. The rows named by SetTableHeaderRowCount become header cells.

Turning the mode on also marks the document as tagged. A reader treats structure as absent until that mark is present, so a document tagged without it reads as though it had no structure at all.

Automatic tagging stands aside inside a tag opened with BeginTag: while the caller is describing the structure itself, nothing is nested inside what it opened. It also never tags inside an artifact, where a structure element would make the file invalid, and never opens an element for empty text, which a reader would announce as a blank.

The mode belongs to the library instance, not to a document.

Example

PDF.SetAutoTagMode(3);
PDF.RegisterHeading(1, 'Chapter One');
PDF.DrawText(72, 100, 'Chapter One');      // tagged H1
PDF.DrawText(72, 130, 'Body text.');       // tagged P
PDF.AddPageFooter('', 'Confidential', 30, 1, 1);  // an artifact

See also

GetAutoTagMode, RegisterHeading, BeginTag, BeginArtifact, RegisterFigure, RegisterDecoration, SetTableHeaderRowCount