Some test text!

Search
Hamburger Icon

Xamarin / Guides / Form flatten

Flatten PDF form content in Xamarin

To flatten form fields in a PDF document.

PDFDoc doc = new PDFDoc(filename);

// flatten only form fields
doc.FlattenAnnotations(true);

PDF interactive forms (AcroForms)
Full sample code which illustrates some basic PDFNet capabilities related to interactive forms (also known as AcroForms) and annotation flattening.

About form flattening

Form flattening refers to the operation that changes active form fields into a static area that is part of the PDF document, just like other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields.

Using the Field.Flatten()or Page.FlattenField() methods, it is possible to merge individual field appearances with the page content. Apryse SDK also allows you to flatten all forms in the document in a single function call, with PDFDoc.FlattenAnnotations(true). (The true argument instructs Apryse SDK to only flatten fields; were this method passed false, or no argument, it would flatten all annotations as well as all fields.)

Note that it is not possible to undo the Field.Flatten() operation. An alternative approach, one that can be programmatically reversed, would be to set the field as read only using the Field.SetFlag(Field.e_read_only, true) method.

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales