using System.IO; using System.Drawing; using Syncfusion.Pdf; using Syncfusion.Pdf.Interactive; // Load the PDF document PdfLoadedDocument document = new PdfLoadedDocument("input.pdf"); // Get the form fields from the document PdfFormFields formFields = document.Form.Fields; // Flatten the form fields formFields.FlattenFields(); // Save the flattened document to a new file document.Save("output.pdf"); document.Close();
using System.IO; using System.Drawing; using Syncfusion.Pdf; using Syncfusion.Pdf.Interactive; // Load the PDF document PdfLoadedDocument document = new PdfLoadedDocument("input.pdf"); // Get the specific form field from the document PdfLoadedFormField formField = (PdfLoadedFormField)document.Form.Fields["fieldName"]; // Flatten the specific form field formField.Flatten = true; // Save the flattened document to a new file document.Save("output.pdf"); document.Close();In this example, we use the Syncfusion.Pdf library to load a PDF document and then flatten a specific form field by setting its Flatten property to true. The resulting document is saved to a new file. Package library: Syncfusion.Pdf