Foxit SDK .NET

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 March 7, 2019

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: