Flatten just electronic signatures in PDFs


We are currently using Aspose.Pdf 17.3 for .NET and we are exploring possible ways to flatten JUST electronic signatures in a PDF.
Flattening the entire PDF is an overkill since we do not want links from table of contents to get flatten as well.

Can you please let us know if that is something we can accomplish?

Thank you!


Thanks for contacting support.

Aspose.Pdf for .NET offers you to flatten all form fields as well as flatten particular annotation(s) inside PDF document. Furthermore, you may also add JavaScript actions to fields to get some desired results. Would you please share your sample document with us? We will try to accomplish your requirement in our environment and respond you accordingly.


We have further checked the details in this regard. You can make a particular form field ReadOnly by using Aspose.Pdf.Facades.FormEditor.SetFieldAttribute() method. Please check following code snippet where I have made a Signature Field ReadOnly by above mentioned method.

Document doc = new Document(dataDir + "SignatureField.pdf");
Facades.FormEditor editor = new Facades.FormEditor(doc);
editor.SetFieldAttribute("sign1", Facades.PropertyFlag.ReadOnly);
doc.Save(dataDir + "SignatureField_Flattened.pdf");

For your reference, I have attached input/output files as well. In case of any further assistance, please feel free to contact us.

SignatureField_Flattened.pdf (1.6 KB)
SignatureField.pdf (1.6 KB)

Looks like this code snippet will do the trick.
Thank you!


Thanks for your feedback.

Adding more to my previous comments, you may also try Facades.Form.FlattenField() method to flatten a particular form field. Please check following code snippet which demonstrate the usage of above method.

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();
Document doc = new Document(dataDir + "SignatureField.pdf");
pdfForm.Save(dataDir + "SignatureFields_outFlattened.pdf"); 

In case of any further assistance, please feel free to contact us.