@adobe/pdfservices-node-sdk
Version:
The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.
77 lines (76 loc) • 3.13 kB
TypeScript
import { PDFServicesJob } from "./PDFServicesJob";
import { Asset } from "../../io/Asset";
import { DocumentMergeParams } from "../params/documentmerge/DocumentMergeParams";
import { ExecutionContext } from "../../internal/ExecutionContext";
import { NotifierConfig } from "../../config/notifier/NotifierConfig";
/**
* A job that enables the clients to produce high fidelity PDF and Word documents with dynamic data inputs.
* This operation merges the JSON data with the Word template to create dynamic documents for contracts and
* agreements, invoices, proposals, reports, forms, branded marketing documents and more.
* <p>
* To know more about document generation and document templates, please see the
* <a href="http://www.adobe.com/go/dcdocgen_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 inputAsset = await pdfServices.upload({
* readStream,
* mimeType: MimeType.DOCX
* });
*
* const jsonDataForMerge = JSON.parse("{\"customerName\": \"James\", \"customerVisits\": 100}");
*
* const params = new DocumentMergeParams({
* jsonDataForMerge,
* outputFormat: OutputFormat.DOCX
* });
*
* const job = new DocumentMergeJob({inputAsset, params});
*
* const pollingURL = await pdfServices.submit({job});
*
* const pdfServicesResponse = await pdfServices.getJobResult({
* pollingURL,
* resultType: DocumentMergeResult
* });
*
* const resultAsset = pdfServicesResponse.result.asset;
* const streamAsset = await pdfServices.getContent({asset: resultAsset});
* ```
*/
export declare class DocumentMergeJob extends PDFServicesJob {
private readonly _inputAsset;
private readonly _documentMergeParams;
private readonly _outputAsset?;
/**
* Constructs a new `DocumentMergeJob` instance.
*
* @param params The parameters for constructing an instance of `DocumentMergeJob`.
* @param params.inputAsset {@link Asset} object containing the input file. Cannot be undefined.
* @param params.params {@link DocumentMergeParams} object containing the parameters for document
* generation. 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: DocumentMergeParams;
outputAsset?: Asset;
});
/**
* @hidden
*/
process(executionContext: ExecutionContext, notifierConfigList?: NotifierConfig[]): Promise<string>;
private generatePDFServicesAPIRequest;
}