Flatten all the form fields from a document using Foxit PDF .NET SDKs
Flattening the form fields of a PDF is the process that will take the values of the form fields, add them to the actual PDF stream and then remove all of the form field structures from the document. The advantages of flattening form fields are that you achieve a PDF that is simpler and smaller as well as a PDF in which the field values not as easily edited.
The following examples demonstrates how to flatten all the form fields within a PDF:
Using Visual Basic:
Dim document As MergeDocument = New MergeDocument("C:\AcroForm.pdf") document.Form.Output = FormOutput.Flatten document.Draw("C:\AcroForm_Flattened.pdf")
MergeDocument document = new MergeDocument(@"C:\AcroForm.pdf"); document.Form.Output = FormOutput.Flatten; document.Draw(@"C:\AcroForm_Flattened.pdf");
Updated on March 7, 2019