Working with PDF AcroForms in Xamarin Pdf Viewer (SfPdfViewer)

PDF Viewer supports adding/modifying the existing forms fields content present in the PDF document. By default, it detects the form fields present in the PDF document and enables modifying or filling the values.

How to restrict editing the form field values in the existing PDF document

By setting the EnableFormFilling property of the PdfViewerControl instance to false, you can avoid modifying the values of the form field elements present in the loaded PDF document.

//Does not load the form fields in PDF viewer
pdfViewerControl.EnableFormFilling = false;

NOTE

By default, the EnableFormFilling property is set to true.

How to flatten and save the form fields data

Flattening PDF form is a process of removing the form fields in the PDF document, thereby rendering the form fields appearance and its content in the page graphics. This will avoid the PDF form being edited in any device. PDF Viewer supports flattening the PDF form when saving. You can perform this action by passing the parameter true to the Save method of PDF Viewer.

//Flatten and save the form fields during saving process
pdfViewerControl.SaveDocument(true);