We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to flatten specific fields on form and not all fields

Dear support,

I'm wondering if its possible to flatten specific fields on PDF and not the whole form. If yes, would you please share a sample code to achieve that

Best regards,


1 Reply

MK Moorthy Karunanithi Syncfusion Team February 16, 2023 07:16 AM UTC

Thank you for contacting Syncfusion Support.

Yes, we do have support for flattening specific fields from PDF documents. To achieve this, please refer to the example code below.

            //Load the PDF document.

            PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");

            //Get the loaded form.

            PdfLoadedForm loadedForm = loadedDocument.Form;


            //Get the field using the index

            PdfLoadedField loadedField = loadedForm.Fields[2] as PdfLoadedField;           



                loadedField.Flatten = true;



            //Get the field using a field name

            loadedForm.Fields.TryGetField("employeesRadioList", out loadedField);

            if (loadedField != null)


                loadedField.Flatten = true;



            MemoryStream memoryStream = new MemoryStream();

            //Save the document.


            //close the document.


Please let us know if you need any further assistance

Live Chat Icon For mobile
Up arrow icon