HTML JPG PDF XML DOCX
  Product Family
PDF

Get PDF Forms in Node.js SDK

Get all of the Form Fields from a PDF Document using Node.js Cloud SDK

Get Started

Get an AcroForms from PDF document via Cloud Node.js SDK

In order to get an AcroForms from PDF, we’ll use Aspose.PDF Cloud Node.js SDK. This Cloud SDK assists Node.js programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Node.js programming language via Aspose.PDF REST API. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Node.js SDK.

Package Manager Console Command


     
    npm install asposepdfcloud --save
     
     

Steps to get AcroForms via Node.js

Aspose.PDF Cloud developers can easily load & get acroforms from PDF in just a few lines of code.

  1. Upload the PDF file to the Aspose.PDF Cloud service.
  2. Log any errors that occur during the file upload.
  3. Retrieve the form fields from the PDF file in the Aspose.PDF Cloud storage.
  4. Iterate through the form fields and log the field names and values to the console.
  5. Log any errors that occur during the field retrieval
  6. Download the result if needed it
 

This sample code shows getting an AcroForms from PDF documents using Node.js


    import credentials from "./credentials.json" with { type: "json" };
    import fs from 'node:fs/promises';
    import { PdfApi } from "asposepdfcloud";
    import { Border } from "asposepdfcloud/src/models/border";
    import { TextBoxField } from "asposepdfcloud/src/models/textBoxField";
    import { Dash } from "asposepdfcloud/src/models/dash";
    import { Rectangle } from "asposepdfcloud/src/models/rectangle";
    import { Field } from "asposepdfcloud/src/models/field";
    import { FieldType } from "asposepdfcloud/src/models/fieldType";
    import { Fields } from "asposepdfcloud/src/models/fields";

    async function getFormFields() {
        const localFileName = "C:\\Samples\\StudentInfoFormElectronic.pdf";
        const storageFileName = "StudentInfoFormElectronic.pdf";

        const pdfApi = new PdfApi(credentials.id, credentials.key);
        try {
            let fileData = await fs.readFile(localFileName);
            let uploadResult = await pdfApi.uploadFile(storageFileName, fileData);
            console.log(uploadResult.response.text);
        }
        catch (error) {
            console.error(error.message);
        }

        try {
            let response = await pdfApi.getFields(storageFileName);
            for (const item of response.body.fields.list) {
                if (item.type == "List") {
                    console.log(`Name: [${item.Name}] Value: [${item.Values.join()}]`);
                }
                else {
                    console.log(`Name: [${item.name}] Value: [${item.values[0]}]`);
                }
            }
        } catch (error) {
            console.error(error.message);
        }
    }
 

Work with the AcroForms via Node.js SDK

Extracting AcroForm data allows you to compile and analyze information collected from users efficiently, such as surveys or application responses. Retrieved AcroForm data can be integrated into databases, spreadsheets, or other systems for further processing or record-keeping. Extracting AcroForms helps in auditing filled-out forms to verify the accuracy, authenticity, or completeness of the provided data. Retrieving AcroForms is essential when transferring forms to other document management systems or creating backups. Get the AcroForms from PDF documents with Aspose.PDF Cloud Node.js SDK.

With our Node.js library you can

  • Add PDF document’s header & footer in text or image format.
  • Add tables & stamps (text or image) to PDF documents.
  • Append multiple PDF documents to an existing file.
  • Work with PDF attachments, annotations, & form fields.
  • Apply encryption or decryption to PDF documents & set a password.
  • Delete all stamps & tables from a page or entire PDF document.
  • Delete a specific stamp or table from the PDF document by its ID.
  • Replace single or multiple instances of text on a PDF page or from the entire document.
  • Extensive support for converting PDF documents to various other file formats.
  • Extract various elements of PDF files & make PDF documents optimized.
  • You can try out our free App to get the AcroForms from PDF files online and test the functionality.