UNPKG

@adobe/pdfservices-node-sdk

Version:

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

68 lines (67 loc) 2.58 kB
import { PDFServicesJob } from "./PDFServicesJob"; import { Asset } from "../../io/Asset"; import { RemoveProtectionParams } from "../params/removeprotection/RemoveProtectionParams"; import { ExecutionContext } from "../../internal/ExecutionContext"; import { NotifierConfig } from "../../config/notifier/NotifierConfig"; /** * A job that allows to remove password security from a PDF document. * * @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 inputAsset = await pdfServices.upload({ * readStream, * mimeType: MimeType.PDF * }); * * const params = new RemoveProtectionParams({ * password: "password" * }); * * const job = new RemoveProtectionJob({inputAsset, params}); * * const pollingURL = await pdfServices.submit({job}); * * const pdfServicesResponse = await pdfServices.getJobResult({ * pollingURL, * resultType: RemoveProtectionResult * }); * * const resultAsset = pdfServicesResponse.result.asset; * const streamAsset = await pdfServices.getContent({asset: resultAsset}); * ``` */ export declare class RemoveProtectionJob extends PDFServicesJob { private readonly _inputAsset; private readonly _outputAsset?; private readonly _params; /** * Constructs a new `RemoveProtectionJob` instance. * * @param params The parameters for constructing an instance of `RemoveProtectionJob`. * @param params.inputAsset The input asset for the job. Cannot be undefined. * @param params.params {@link RemoveProtectionParams} object to specify the password to remove the protection * from the PDF document. Cannot be undefined. * @param [params.outputAsset] {@link Asset} object representing the output asset. * @remarks External assets can be set as output only when input is external asset as well. */ constructor(params: { inputAsset: Asset; params: RemoveProtectionParams; outputAsset?: Asset; }); /** * @hidden */ process(executionContext: ExecutionContext, notifierConfigList?: NotifierConfig[]): Promise<string>; private generatePDFServicesAPIRequest; }