How to Get PDF Form Fields and Values using Node.js

2 min readSep 27


Form fields are very useful features in PDF documents, and we can easily extract any given PDF’s form fields/values with an API call.

All we need to do is use the ready-to-run Node.js code examples below to structure our API call. In a quick request, we can retrieve field names, field types, field values, and field indices.

We first need to install the SDK by either running the following command:

npm install cloudmersive-convert-api-client --save

Or by adding the following snippet to our package.json:

  "dependencies": {
"cloudmersive-convert-api-client": "^2.6.3"

Then we can use the below code to structure our request, and we can provide a free-tier API key to authorize up to 800 API calls per month with zero additional commitments:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;

// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';

var apiInstance = new CloudmersiveConvertApiClient.EditPdfApi();

var inputFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // File | Input file to perform the operation on.

var callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.editPdfGetFormFields(inputFile, callback);

That’s all there is to it — we’ll receive an object with our fields/values and we can parse important information from there.




There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.