Class DocumentMergeJob
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.
To know more about document generation and document templates, please see the documentation
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class DocumentMergeJob : PDFServicesJob
Examples
Sample Usage:
using Stream inputStream = File.OpenRead("<SOURCE_PATH>");
ICredentials credentials = new ServicePrincipalCredentials(
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_ID"),
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_SECRET"));
PDFServices pdfServices = new PDFServices(credentials);
IAsset asset = pdfServices.Upload(inputStream, PDFServicesMediaType.DOCX.GetMIMETypeValue());
JObject jsonDataForMerge = JObject.Parse("{\"customerName\": \"James\",\"customerVisits\": 100}");
DocumentMergeParams documentMergeParams = DocumentMergeParams.DocumentMergeParamsBuilder()
.WithJsonDataForMerge(jsonDataForMerge)
.WithOutputFormat(OutputFormat.DOCX)
.Build();
DocumentMergeJob documentMergeJob = new DocumentMergeJob(asset, documentMergeParams);
String location = pdfServices.Submit(documentMergeJob);
PDFServicesResponse<DocumentMergeResult> pdfServicesResponse =
pdfServices.GetJobResult<DocumentMergeResult>(location, typeof(DocumentMergeResult));
IAsset resultAsset = pdfServicesResponse.Result.Asset;
StreamAsset streamAsset = pdfServices.GetContent(resultAsset);
Constructors
DocumentMergeJob(IAsset, DocumentMergeParams)
Constructs a new DocumentMergeJob
instance.
Declaration
public DocumentMergeJob(IAsset asset, DocumentMergeParams documentMergeParams)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | The input IAsset for the job; can not be null. |
Document |
documentMergeParams | The input Document |
Methods
SetOutput(IAsset)
Sets the output asset for the job.
Declaration
public DocumentMergeJob SetOutput(IAsset asset)
Parameters
Returns
Type | Description |
---|---|
Document |
|
Remarks
External assets can be set as output only when input is external asset as well