View as MarkdownMarkdown
If the output PDF file contains form fields, you can flatten them to reduce the file size.
To remove form fields, set the setRemoveFormFields() property to true in PdfOptimizationOptions.
The following code snippet shows how to flatten form fields in the file:
The following image demonstrates the result:

We value your opinion. Your feedback will help us improve our documentation.