1. Home
  2. Foxit SDK .NET
  3. Flatten all the form fields from a document using Foxit PDF .NET SDKs

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")

Using C#:

MergeDocument document = new MergeDocument(@"C:\AcroForm.pdf");
document.Form.Output = FormOutput.Flatten;
document.Draw(@"C:\AcroForm_Flattened.pdf");
Updated on October 7, 2019

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial