RegisterHeading
Page layout
Description
Records a heading on the selected page for a later table of contents.
Syntax
Delphi
Function TPDFlib.RegisterHeading(Level: Integer; Const Title: WideString): Integer;Parameters
| Level | Nesting level, 1 for a top-level heading. |
|---|---|
| Title | The text to list. |
Return values
| Count | How many headings are registered. |
|---|---|
| 0 | The level or the title was empty, or no page is selected. |
Remarks
The heading remembers where it points, not which page number it currently has. That is what lets the contents page be inserted in front of the finished body - which renumbers every page it refers to - without any entry or link needing to be fixed up.
Registrations belong to the document that was selected at the time. Opening another document leaves them in place but they no longer resolve, so a contents page can only be drawn into the document its headings came from.
Example
PDF.DrawText(72, 100, 'Chapter One');
PDF.RegisterHeading(1, 'Chapter One');