This sample shows how to flatten form fields in a PDF document using Docotic.Pdf library.
To flatten form fields in a PDF file, please use the PdfDocument.FlattenControls method. This method draws each control on its parent page and then removes the control from the document.
Flattening locks form fields from editing and can significantly reduce output file size.
Alternatively, you can:
- Flatten controls and annotations using the PdfDocument.FlattenWidgets method
- Flatten individual controls or annotations using the PdfWidget.Flatten method