HTML JPG PDF XML DOCX
  Product Family
PDF

Get Signature from PDF documents via Node.js SDK

API for extracting Signatures from PDF documents using Aspose.PDF Cloud Node.js SDK

Get Started

How to get signature from PDF documents via Node.js SDK

To extract signature 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 signature from PDF via Cloud Node.js

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

  1. Read the local PDF file.
  2. Extract Signature Fields
  3. Downloads the updated PDF file from the Aspose PDF Cloud storage.
 

Extract signature from PDF using Node.js


    import credentials from "../../../Credentials/credentials.json"  with { type: "json" };
    import fs from 'node:fs/promises';
    import path from 'node:path';
    import { PdfApi } from "../../src/api/api.js";


    const configParams = {
        LOCAL_FOLDER: "C:\\Samples\\",
        PDF_DOCUMENT_NAME: "sample-signed.pdf",
    }

    const pdfApi = new PdfApi(credentials.id, credentials.key);

    const pdfSignatures = {
        async uploadDocument () {
            const fileNamePath = path.join(configParams.LOCAL_FOLDER, configParams.PDF_DOCUMENT_NAME);
            const pdfFileData = await fs.readFile(fileNamePath);
            await pdfApi.uploadFile(configParams.PDF_DOCUMENT_NAME, pdfFileData);
            console.log("File '" + configParams.PDF_DOCUMENT_NAME + "' successfully uploaded!");
        },

        showSignatureFieldsArray(fields)
        {
            if (fields.list.length > 0)
                fields.list.forEach(function(item) {
                    console.log("Signature => value: '" + item.signature.contact + "'");
                });
            else
                console.log("Signature fileds is empty!");
        },

        async getSignatureFields () {
            if (pdfApi)
            {
                const response = await pdfApi.getDocumentSignatureFields(configParams.PDF_DOCUMENT_NAME);

                if (response.body.code == 200 && response.body.fields) {
                    console.log("getSignatureFields(): Signature fields successfully extracted in to the '" + configParams.PDF_DOCUMENT_NAME + "' documen:")
                    this.showSignatureFieldsArray(response.body.fields);
                }
                else
                    console.error("getSignatures(): Failed to extract signatures in the document. Response code: " + response.body.code);
            }
        },
    }

    async function main() {
        try {
            await pdfSignatures.uploadDocument();
            await pdfSignatures.getSignatureFields();
        } catch (error) {
            console.error("Error:", error.message);
        }
    }
 

Work with Signature in PDF

Extracting signatures from a PDF is essential for verifying document authenticity, auditing digital transactions, and ensuring compliance with legal or regulatory standards. By retrieving signature fields, organizations can confirm who signed the document, when it was signed, and whether the document has been altered since. This process helps maintain trust in digital workflows and provides traceable evidence of approval or agreement. Extract Signature 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 Apps to test the functionality online.