UNPKG

@adobe/pdfservices-node-sdk

Version:

The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.

98 lines (97 loc) 3.65 kB
import { PDFServicesJob } from "./PDFServicesJob"; import { Asset } from "../../io/Asset"; import { PDFElectronicSealParams } from "../params/electronicseal/PDFElectronicSealParams"; import { ExecutionContext } from "../../internal/ExecutionContext"; import { NotifierConfig } from "../../config/notifier/NotifierConfig"; /** * A job that allows clients to apply an electronic seal onto various PDF documents such as * agreements, invoices, and more. * <p> * To know more about PDF Electronic Seal, please see the * <a href="http://www.adobe.com/go/dc_eseal_overview_doc" target="_blank">documentation</a>. * <p> * * @example * Sample Usage: * ```js * const readStream = fs.createReadStream("SOURCE_PATH") * * const credentials = new ServicePrincipalCredentials({ * clientId: process.env.PDF_SERVICES_CLIENT_ID, * clientSecret: process.env.PDF_SERVICES_CLIENT_SECRET * }); * * const pdfServices = new PDFServices({credentials}); * * const sourceFileAsset = await pdfServices.upload({ * readStream: readStream, * mimeType: MimeType.PDF * }); * * const certificateCredentials = new CSCCredential({ * providerName: "<PROVIDER_NAME>", * credentialId: "<CREDENTIAL_ID>", * pin: "<PIN>", * authorizationContext: new CSCAuthContext({accessToken: "<ACCESS_TOKEN>"}) * }); * * const sealFieldName = "Signature1"; * const sealFieldOptions = new FieldOptions({ * fieldName: sealFieldName, * pageNumber: 1, * location: new FieldLocation({ * left: 150, * top: 250, * right: 350, * bottom: 200 * }) * }); * * const params = new PDFElectronicSealParams({ * certificateCredentials, * sealFieldOptions, * }); * * const job = new PDFElectronicSealJob({ * inputAsset: sourceFileAsset, * params, * }); * * const pollingURL = await pdfServices.submit({job}); * * const pdfServicesResponse = await pdfServices.getJobResult({ * pollingURL, * resultType: PDFElectronicSealResult * }); * * const resultAsset = pdfServicesResponse.result.asset; * const streamAsset = await pdfServices.getContent({asset: resultAsset}); * ``` */ export declare class PDFElectronicSealJob extends PDFServicesJob { private readonly _inputDocumentAsset; private readonly _sealImageAsset?; private readonly _pdfElectronicSealParams; private readonly _outputAsset?; /** * Constructs a new `PDFElectronicSealJob` instance. * * @param params The parameters for constructing an instance of `PDFElectronicSealJob`. * @param params.inputAsset The input asset for the job. Cannot be undefined. * @param [params.sealImageAsset] {@link Asset} object representing the seal image. * @param params.params {@link PDFElectronicSealParams} object to specify the electronic seal parameters. * Cannot be undefined. * @param [params.outputAsset] - {@link Asset} object representing the output asset. */ constructor(params: { inputAsset: Asset; sealImageAsset?: Asset; params: PDFElectronicSealParams; outputAsset?: Asset; }); /** * @hidden */ process(executionContext: ExecutionContext, notifierConfigList?: NotifierConfig[]): Promise<string>; private generatePDFServicesAPIRequest; }