Free Support Forum -

How to get PDF Form Fields in Order Shown in PDF Document with Aspose.PDF REST API

I am evaluating Aspose.Pdf for Cloud. The primary function I need is the ability to extract data about the fields present in a PDF form. I’ve written some test code using this example:

The fetch works fine, with one glaring exception… the fields come back grouped by datatype (text, checkbox, etc.) and in alphabetical order by name. What I need is a list of form fields, shown in the exact order that they existing in the source document.

Are there any options I can add this GET:{documentname}/fields?appsid=xxxx&signature=xxxx

That would return the order fields in the order I need them?

Without this ability, Aspose.Pdf for Cloud does not meet my requirements.

Thanks for the help!



Thank you for your inquiry and sharing details.

Fields are not grouped by field type. While fetching fields, fields are returned based on the order of field creation. Field created first will be returned first while get fields. For example I have created 6 fields in test.pdf file using Create a Form Field in a PDF Document example in following order

1- Field Type 0
2- Field Type 0
3- Field Type 2
4- Field Type 3
5- Field Type 0
6- Field Type 0

After fields creation, I used test.pdf file to test the Get all Form Fields from the PDF Document
functionality and found returned order is same as order of field creation.

You can download test.pdf file from GitHub to test the functionality at your end.

You can also use our swagger link to test the API functionality. Please follow below steps to test the API functionality

1- Open URL Get Fields
2- Enter your App Key and App Sid in right top corner.
3- Enter required parameters like name ‘test.pdf’ and version 1.1.
4- Click Try it out button.
5- It will return you Request URL and list of fields in Response body.

Using swagger link you can test all methods of cloud APIs.

If you have any further questions, please feel free to share.


Naeem Akram