cmcati-sign-pdf
v0.0.1
Published
Made by [CMC ATI](https://cmcati.vn/)
Downloads
4
Readme
cmcati-sign-pdf
Made by CMC ATI
Library that supports signing PDF documents by generating a hash value, then getting its signature provided by external services
Installation
npm install cmcati-sign-pdf
Usage
Declare the library and initialize the variable containing the PDF document
const { CmcAtiPdf } = require("cmcati-sign-pdf");
const pdf = new CmcAtiPdf();
You can use import
instead of require
if you use Typescript
import { CmcAtiPdf } from "cmcati-sign-pdf"
Load the pdf document through the original property. The library supports data types: Buffer
, ArrayBuffer
, Unit8Array
or string
(base64 plain text, excluding "data:application/pdf;base64" at the beginning)
Next, create a placeholder and get the hash value to send a request to an external service that returns the signature and certificate with the generateHexToBeSigned
function
Send the hash value from the previous step to an external service for signing. Finally, use the sign
function to replace the placeholder with a valid signature