Escribal
Back to Docs

PDF

Table of contents

This group inserts an automatic table of contents at the front of a PDF, built from the document’s headings. It scans every paragraph styled as a heading (Heading 1 through Heading 6), lists the ones within a chosen level range, and places the list on its own page at the very beginning of the document.

Prerequisite: before using this instruction, the workflow must already have a PDF created (with Create PDF), and that PDF should contain paragraphs styled as headings (Heading 1–6) — those are what the table of contents is built from.

These concepts are explained here once.

  • Document: indicates which document in the workflow the instruction applies to. If left empty, the current document is used. If the document doesn’t exist (or is not a PDF), the instruction simply does nothing.
  • Heading levels: the table of contents is built from paragraphs styled as headings. A heading’s level is its rank: 1 = Heading 1 (top level), 2 = Heading 2, and so on up to 6. The Min level and Max level fields choose which levels to include.
  • Dynamic values (@name): in a text field (title, font name, leader char) you can type @ followed by the name of a value saved earlier in the workflow, and it will be replaced by that value.
  • “From variable” fields: numeric fields (min level, max level, page width) can’t use @name. Instead each has a companion “from variable” field: leave it empty to use the normal field, or fill it with the name of a saved value to read the number from there.
  • Saving a result: the instruction can save how many entries the table of contents contains into a named value (its Save entry count field). If you leave that field empty, nothing is saved. You can reuse the saved value later in the workflow.

Insert Table Of Contents .pdf

Builds a table of contents from the document’s headings and inserts it as a new page at the very beginning of the PDF. Each entry shows the heading text on the left and a page number on the right, connected by a leader (a line of dots, dashes, etc.).

When to use it: to give a long PDF a contents page listing its sections, without typing the list by hand.

Parameter Meaning Default Required
Document Document the instruction applies to (current document) No
Min level Lowest heading level to include (1 = Heading 1) 1 No
Max level Highest heading level to include (up to 6) 3 No
Title Heading shown at the top of the contents page. Supports @name Table of Contents No
Font name Font applied to the title and the entries. Empty = the document’s default font. Supports @name (empty) No
Leader char Fill drawn between an entry’s text and its page number: dots, dashes, lines, or none. Supports @name dots No
Page width cm Page width, in centimeters, used to line up the page numbers on the right 16.0 No
Min level (from variable) Read Min level from a saved value instead (empty) No
Max level (from variable) Read Max level from a saved value instead (empty) No
Page width cm (from variable) Read Page width cm from a saved value instead (empty) No
Save entry count Name under which the number of entries found is saved. Empty = don’t save (empty) No

Important behavior:

  • Page numbers always show 0. The underlying PDF engine cannot work out real page numbers before the document is generated, so every entry’s page number is shown as 0. The contents page is still useful as an outline of the document’s structure.
  • Only paragraphs styled as headings (Heading 1–6) are listed; ordinary paragraphs are ignored, as are headings whose level falls outside the Min level–Max level range, and empty headings.
  • If Min level is greater than Max level, nothing happens.
  • The contents page is inserted as a new section at the very front of the document, and it copies the page size, orientation, and margins of the document’s last section.
  • Entries are indented and made slightly smaller for each deeper heading level.
  • If the document isn’t an open PDF, nothing happens.

This documentation is the help of the application, and it comes underCreative Commons Attribution 4.0.