pdfAddTableOfContents Step
Description:
The PDF Add Table of Contents step enables a FlowWright workflow to add a table of contents (TOC) to an existing PDF document.
Large documents such as technical manuals, policy documents, engineering specifications, user guides, and compliance reports often require a table of contents to improve navigation and document usability. Instead of manually creating and inserting a TOC, this workflow step automates the process by generating a table of contents and inserting it after a specified page within the PDF document.
The workflow specifies the source PDF document, the page after which the table of contents should be inserted, the output location, and the FlowWright virtual file path associated with the updated document.
Typical uses include:
- Generating user manuals
- Publishing technical documentation
- Creating product guides
- Preparing compliance documentation
- Building engineering specifications
- Producing training manuals
- Creating policy and procedure documents
- Publishing customer documentation
This step helps organizations improve document organization, navigation, and usability while eliminating manual editing.
Inputs
- Input File Path - Specifies the full path of the PDF document that will receive the table of contents.
- After Page Number – Specifies the page number after which the generated table of contents will be inserted.
- Output File Path – Specifies the location where the updated PDF document will be saved.
- PDF Virtual File Path – Specifies the FlowWright virtual file path associated with the updated PDF document for use by subsequent workflow activities.
Returns
- True – The table of contents was successfully generated, inserted into the PDF document, and the updated document was saved. Workflow execution continues through the success path.
- False – The table of contents could not be added because of an invalid input file, invalid page number, inaccessible output location, or another execution error. Workflow execution follows the alternate path.
Usage:
The PDF Add Table Of Contents step is typically used after a PDF document has been generated and before it is distributed, archived, published, or delivered to end users.
During execution:
- Read the configured input PDF file.
- Read the configured page number where the table of contents should be inserted.
- Generate the table of contents.
- Insert the table of contents after the specified page.
- Save the updated PDF document to the configured output location.
- Associate the document with the configured PDF virtual file path.
- Continue workflow execution through either the True or False return path.
A typical workflow might look like this:

Typical workflow scenarios include:
- Creating product documentation
- Publishing employee handbooks
- Building customer user guides
- Generating software installation manuals
- Producing engineering documentation
- Creating compliance and audit reports
- Publishing operational procedures
Example:
Let’s build and execute the “pdfAddTableOfContentsDef” example.
- Create a new process definition named “pdfAddTableOfContentsDef” and open it in designer mode.
- Drag the “pdfAddTableOfContents” step to the canvas.
- Connect the dots between the “Start” step and “pdfAddTableOfContents” steps, as shown above.
- Define a variable or a global variable to store the file path result.
- Click the "pdfAddTableOfContents" step to configure its "Required" properties. Provide a name for the step. Provide the source file path on the application server. Specify the page number where you want to insert the table of contents. Provide variable references to store the Output and Virtual PDF file paths. Click the Save button. Note: Click the "AI Predict" button for the Copilot to add new process steps that match your process description.

- The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

- Save the process definition, create a new instance, and execute it. Render the process instance. Click the “pdfAddTableOfContents” process step to view its properties. The step creates a copy of the PDF with a table of contents inserted, as configured. Copy and paste the “pdfVirtualPath” variable value into a browser window to view the PDF.
Tips:
- Insert the table of contents immediately after the title or cover page to improve document navigation.
- Verify that the specified page number exists within the input PDF.
- Review the generated document to ensure the table of contents appears in the intended location.
- Preserve the original PDF if a version without a table of contents must be retained.
- Configure the PDF virtual file path when downstream FlowWright workflow steps need to reference the updated document.
- Route the False path to logging or notification activities for easier troubleshooting.
- Combine this step with PDF WaterMarks, PDF Optimize File, PDF Encrypt Secure, PDF Flatten File, PDF Validate Standard, or Send Email to build comprehensive document publishing workflows.
Notes:
- A valid input PDF file is required.
- The After Page Number property is required and should reference an existing page within the document.
- The output file path must reference a writable location.
- The updated PDF is saved to the configured output location.
- The configured PDF virtual file path enables subsequent FlowWright workflow activities to reference the updated document.
- Both the True and False return paths should be implemented to provide complete workflow handling.
- Execution details and table of contents generation activities are recorded in the FlowWright workflow execution log.
PDF Add Table Of Contents vs. PDF Encrypt Secure:
Both workflow steps modify PDF documents, but they address different document management requirements.
| PDF Add Table Of Contents | PDF Encrypt Secure |
|---|---|
| Inserts a table of contents into a PDF document. | Encrypts a PDF document using passwords and a selected encryption method. |
| Focuses on improving document navigation and usability. | Focuses on securing document access and protecting confidential information. |
| Requires the page number after which the table of contents should be inserted. | Requires user password, owner password, and an encryption type. |
| Produces a better-organized PDF document with improved navigation. | Produces a password-protected PDF document. |
| Ideal for manuals, guides, reports, technical documentation, and policy documents. | Ideal for confidential reports, contracts, financial documents, and secure document distribution. |
As a general guideline:
- Use PDF Add Table Of Contents when workflows need to improve document organization and make lengthy PDF documents easier to navigate.
- Use PDF Encrypt Secure when workflows need to protect PDF documents against unauthorized access by applying password-based encryption.
Definition Sample:
You may download the sample workflow definition from the link provided and import it into your FlowWright environment.
Note: Verify and complete any missing configuration after importing the sample, including:
- Input PDF file path
- Page number after which the table of contents should be inserted
- Output PDF file path
- PDF virtual file path
- Success and failure workflow branches
- Required file system permissions
After verifying the configuration, save and publish the workflow before execution.