Description:
The PDF Flatten File step enables a FlowWright workflow to create a flattened version of an existing PDF document.
Many PDF documents contain interactive elements such as form fields, annotations, comments, or layers that remain editable after the document has been generated. Flattening converts these interactive elements into static page content, ensuring that the document appears consistently across different PDF viewers and reducing the possibility of accidental or unauthorized modifications.
The workflow specifies the source PDF file, the output location for the flattened PDF, and the FlowWright virtual file path for subsequent workflow processing.
Typical uses include:
- Finalizing completed electronic forms
- Preparing contracts for distribution
- Locking completed invoices
- Preserving document appearance
- Preventing modification of form fields
- Standardizing PDF documents before archival
- Preparing documents for external submission
- Supporting document integrity during workflow processing
This step helps organizations create finalized PDF documents that are suitable for long-term storage, secure distribution, and consistent viewing.
Inputs
- Input File Path - Specifies the full path of the PDF document that will be flattened.
- Output File Path – Specifies the location where the flattened PDF document will be saved.
- PDF Virtual File Path – Specifies the FlowWright virtual file path associated with the flattened PDF document for use by subsequent workflow activities.
Returns
- True – The PDF document was successfully flattened and saved to the specified output location. Workflow execution continues through the success path.
- False – The flattening operation could not be completed because of an invalid input file, inaccessible output location, insufficient permissions, or another execution error. Workflow execution follows the alternate path.
Usage:
The PDF Flatten File step is typically used after PDF documents have been completed, digitally processed, or filled with data and before they are archived, distributed, or submitted to external organizations.
During execution:
- Read the configured input PDF file.
- Flatten the document by converting interactive elements into static content.
- Generate the flattened PDF document.
- Save the flattened PDF 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:
- Finalizing completed application forms
- Flattening signed contracts before distribution
- Creating non-editable invoices
- Preparing documents for regulatory submission
- Archiving completed business forms
- Finalizing engineering documentation
- Publishing finalized reports to customers
Example:
Let’s build and execute the “pdfFlattenFileDef” example.
- Create a new process definition named “pdfFlattenFileDef” and open it in designer mode.
- Drag the “pdfFlattenFile” step to the canvas.
- Connect the dots between the “Start” step and “pdfFlattenFile” steps, as shown above.
- Define a variable or global to store the file path result.
- Click the "pdfFlattenFile" step to configure its "Required" properties. Provide a name for the step. Provide the source file path on the application server. Provide variable references for 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 “pdfFlattenFile” process step to view its properties. The first step flattens the PDF, which reduces its size. Copy and paste the “PDFVirtualPath” variable value into a browser window to view the PDF.
Tips:
- Flatten PDF documents after all form fields have been completed and verified.
- Retain the original editable PDF if future modifications may be required.
- Use descriptive output file names to distinguish flattened documents from editable versions.
- Verify that the output directory has appropriate write permissions.
- Configure the PDF virtual file path when downstream FlowWright workflow steps need to reference the flattened document.
- Route the False path to logging or notification activities to simplify troubleshooting.
- Combine this step with PDF Optimize File, PDF Validate Standard, Redact PDF, Remove Blank Pages, or Send Email to build comprehensive PDF document processing workflows.
Notes:
- A valid input PDF file is required.
- The output file path must reference a writable location.
- Flattening converts interactive PDF elements into static content.
- The flattened PDF is saved to the configured output location.
- The configured PDF virtual file path enables subsequent FlowWright workflow activities to reference the flattened document.
- Both the True and False return paths should be implemented to provide complete workflow handling.
- Execution details and PDF flattening activities are recorded in the FlowWright workflow execution log.
PDF Flatten File vs. Redact PDF:
Both workflow steps modify PDF documents, but they address different document processing requirements.
| PDF Flatten File | Redact PDF |
|---|---|
| Converts interactive PDF elements into static, non-editable content. | Removes or blanks out specified keywords within a PDF document. |
| Preserves document appearance and prevents further modification of interactive elements. | Protects confidential or sensitive information before document distribution. |
| Does not require any content search criteria. | Requires a list of keywords to identify content that should be redacted. |
| Produces a finalized PDF suitable for archival, submission, or distribution. | Produces a sanitized PDF suitable for privacy compliance and secure sharing. |
| Ideal for completed forms, finalized contracts, invoices, and regulatory submissions. | Ideal for removing personally identifiable information (PII), confidential business information, and other sensitive content. |
As a general guideline:
- Use PDF Flatten File when workflows need to finalize PDF documents by converting editable or interactive elements into permanent content.
- Use Redact PDF when workflows must permanently conceal confidential information before documents are shared with external parties or archived.
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
- 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.