I noticed FlattenAllFields also removes the hyperlinks. Is there a way to
get All fields in order to flatten everything except hyperlinks? I
tried getFieldNames but it only returns the fields that were given a
The getFieldNames(…) method tries to retrieve the names of PDF form fields and in case no name is assigned to field, nothing will be returned. However concerning to the scenario of removing hyperlinks, can you please share the resource PDF form so that we can test the scenario at our end. We are sorry for this inconvenience.
Here is the file.
Thanks for sharing the resource file.
I have tested the scenario using following code snippet and as per my observations, the buttons are flattened but hyperlinks are preserved in resultant file. For your reference, I have also attached the resultant PDF generated over my end.
Furthermore, when using the code snippet shared over Get Values from All Fields in a PDF Document, the data and value for two form fields is being returned.
//Open document<o:p></o:p> com.aspose.pdf.Document pdfDocument = **new** com.aspose.pdf.Document("c:/pdftest/MovieButtonHyperlinkPdf_.pdf"); pdfDocument.getForm().flatten(); pdfDocument.save("c:/pdftest/FormFileFlattened.pdf");