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

Free Support Forum - aspose.com

Get all fields

Hello,
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
name.
Thanks,

Hi Camille,


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,
Camille.

Hi Camille,

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.

[Java]

//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");