Pdf | |
The PdfTableOfContentsOptions type exposes the following members.
| Name | Description | |
|---|---|---|
| PdfTableOfContentsOptions |
| Name | Description | |
|---|---|---|
| ContainerSelector | Gets or sets the CSS selector of the element that holds the page's table of contents, for example "#toc". Used by FillExisting. | |
| HeadingSelectors | Gets or sets the CSS selectors of the headings the table of contents lists, one per level: the first selector is level 1. Used by InsertHtml. | |
| HtmlPlacement | Gets or sets where InsertHtml writes the table of contents. The default value is Start. | |
| IncludeDefaultCss | Gets or sets whether the default stylesheet of the table of contents written by InsertHtml is added. When false the page's CSS alone styles it. The default value is true. | |
| Leader | Gets or sets the leader drawn between an entry and its page number. The default value is Dots. | |
| LeaderColor | Gets or sets the color of the leader. The default value is Empty, which uses the color of the page numbers. | |
| LeaderGap | Gets or sets the space, in points, between an entry and its leader and between the leader and the page number. The default value is 3. | |
| LevelStyles | Gets or sets the appearance of the entries of each level drawn by GeneratePages: the first style is level 1. A level beyond the array uses the last style; a property left at its default takes the level's default. | |
| MaxLevel | Gets or sets the deepest level listed by GeneratePages and InsertHtml. The default value is 0, which lists every level. | |
| Mode | Gets or sets how the table of contents is built. The default value is None. | |
| NumberColumnWidth | Gets or sets the width, in CSS pixels, kept free at the end of each entry written by InsertHtml, so that a long entry wraps before its page number. The default value is 40. | |
| NumberEntries | Gets or sets whether the entries drawn by GeneratePages are numbered ("1.", "1.1.", ...). The default value is false. | |
| PageBackColor | Gets or sets the background color of the content area of the pages drawn by GeneratePages (the whole page when the margins are 0), so they can match a page with a colored background. The default value is Empty: no background. | |
| PageBreak | Gets or sets whether the table of contents written by InsertHtml gets a page of its own: a page break after it, or before it when it is placed at the end. No break is added after it when the content that follows already starts a new page. The default value is true. | |
| PageNumberColor | Gets or sets the color of the page numbers. The default value is Empty, which uses the color of the entry's text. | |
| PageNumberFont | Gets or sets the font of the page numbers. The default value is null, which draws them in Helvetica at the size of the entry's text, or in the entry's own font for GeneratePages. | |
| PageNumberRightInset | Gets or sets the distance, in points, between the page numbers and the right edge of the table of contents. The default value is 0. | |
| PagePosition | Gets or sets where GeneratePages inserts its pages. The default value is Start. | |
| PlaceholderSelector | Gets or sets the CSS selector of the element the table of contents is written into when HtmlPlacement is Placeholder. | |
| Title | Gets or sets the title written above the table of contents by InsertHtml. Null or empty writes no title. The default value is "Contents". | |
| TitleAlign | Gets or sets the alignment of the title drawn by GeneratePages. A left-aligned title starts at the indent of the level 1 entries. The default value is Left. | |
| TitleColor | Gets or sets the color of the title drawn by GeneratePages. The default value is Empty, which is black. | |
| TitleFont | Gets or sets the font of the title drawn by GeneratePages. The default value is null, which is Helvetica Bold 18. | |
| TitleSpacingAfter | Gets or sets the space, in points, between the title and the first entry drawn by GeneratePages. The default value is 12. | |
| TitleSpacingBefore | Gets or sets the space, in points, above the title drawn by GeneratePages, from the top of the content area. The default value is 0. |
With Mode set to FillExisting, the page's own table of contents - the element matched by ContainerSelector - is completed: every internal link inside it (<a href="#id">) gets a leader and the number of the pdf page its target is on. The number is drawn at the end of the line where the link's text ends, right-aligned to the container's right edge, so the table of contents keeps the look the page gives it.
With InsertHtml, the table of contents is written into the page first, from the elements matched by HeadingSelectors (the first selector is level 1, the second level 2, and so on): a <nav class="selectpdf-toc"> holding an optional <h2 class="selectpdf-toc-title"> and nested <ol> lists whose items have the classes selectpdf-toc-entry and selectpdf-toc-level-N and hold a link to their heading. A heading without an id is given one. The page's CSS styles it; a small default stylesheet, placed before the page's own styles, removes the list markers and indents the levels.
With GeneratePages, the table of contents is drawn on pages inserted into the pdf document (PagePosition), with the page size, margins, header and footer of the converted pages: the title, then one entry per heading, each a link to its heading, with a leader and its page number. Its appearance comes from TitleFont, TitleColor, TitleAlign, TitleSpacingAfter, LevelStyles and the page number and leader settings. The page numbers count the inserted pages.
The numbers are the page numbers the document shows: they start at the FirstPageNumber of the displayed footer (or of the displayed header when there is no footer). A link whose target is not in the document gets no number. The leaders and numbers are decorative in a tagged document (the links already carry the entries). JavaScript must be enabled.