We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF flattening - Flatten() method is making all fields non-editable but Buttons all are there in PDF - Cannot save as regular PDF

Hi All,

I am using a Aspose.Pdf version 8.5.0. I have some XFA PDF forms that after editing I want to save it as flat PDF. I am using Document.flatten() method which is working fine and making my pdfs file
non-editable. However, The Lock buttons and other buttons to add extra fields which were in the original pdf forms, are still there so I cannot take a printout of that kind of form. I have attached the sample screenshot of my PDF after flattening here just for better idea. I want to remove all that buttons as well and save it as regular printable pdf. Can I do that with Aspose ?

Capture.PNG (11.2 KB)
Capture1.PNG (25.8 KB)


Thanks for contacting support.

Please note that you are using a quite old version of the API - whereas it is always recommended to use latest version (i.e. Aspose.PDF for .NET 18.4), because it contains more fixes and improvements.

Would you please share your sample PDF document along with a code snippet, which you are using to flatten the fields. We will test the scenario in our environment and address it accordingly.

Attached is the sample PDF file which I am trying to save as flatten pdf after filling all the details.

ecaveat_10e.pdf (2.8 MB)

Here is the code snippent that I am using to flatten the PDF.

Capture.PNG (6.3 KB)


Thanks for sharing code snippet and sample document.

We have tested the scenario in our environment and noticed that the buttons inside PDF document did not get flattened/removed after flattening all form fields. Therefore, we have logged an issue as PDFNET-44601 in our issue tracking system for the sake of correction.

We have also observed that after flattening the fields, header of the PDF document got distorted Distorted Header.png (16.1 KB), which seems an issue with the API. We have logged a separate issue as PDFNET-44602 in our issue tracking system for this behavior of the API. Would you please share if you have noticed same issue while using older version of the API?

We will further investigate the logged issues in detail and keep you posted with the status of their rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-44601) have been fixed in Aspose.PDF for .NET 18.6. This message was posted using BugNotificationTool from Downloads module by asad.ali