Show / Hide Table of Contents

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

Inheritance
System.Object
PDFServicesJob
DocumentMergeJob
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.

DocumentMergeParams documentMergeParams

The input DocumentMergeParams object containing the parameters for document generation; can not be null.

Methods

SetOutput(IAsset)

Sets the output asset for the job.

Declaration
public DocumentMergeJob SetOutput(IAsset asset)
Parameters
Type Name Description
IAsset asset

IAsset object representing the output asset; can not be null.

Returns
Type Description
DocumentMergeJob

DocumentMergeJob instance

Remarks

External assets can be set as output only when input is external asset as well

In This Article
  • Constructors
    • DocumentMergeJob(IAsset, DocumentMergeParams)
  • Methods
    • SetOutput(IAsset)
Back to top Copyright © 2020 Adobe. All rights reserved.