Scenario: Creating System Generated Letters

The Asset Compose building block exposes APIs, through the service : LetterRenderService, to generate a letter via an automated process or from an application that needs to generate a correspondence without opening the Create Correspondence user interface.
Note: The generated correspondence will have only the pre-selected and mandatory content included in their target areas. Any fields or variables related to a user are rendered empty, and a warning message is logged.

Using the Letter Object

The following API renders a letter using a Letter object:
public PDFResponseType renderLetter(Letter letter, String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive);
Parameter details:
  • letter: Letter template to be rendered. This must be the full letter object containing all necessary data and assignments.

  • initialDataXML: XML data that will be used to initialize the data dictionary used in the letter, if any, and finally merged with the letter's layout after augmentation with the necessary control data for the letter's content.

    This XML data may be fetched from an external data source.

  • mergeDataOnServer: This parameter should be set to True to merge the relevant data into the letter. Should obviously be true for system generated correspondence.

  • useTestData: Specify whether to use test data for rendering. On a production system, this should be set as false. The given initialDataML is used instead.

  • renderInteractive: Specify whether to render an interactive or non-interactive (flat) PDF file.

Using the Letter Identifier

The following API renders a letter using a Letter identifier:
public PDFResponseType renderLetter(String letterId, String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive);mergeDataOnServer, boolean useTestData, boolean renderInteractive);
Parameter details:
  • letterId: Identifier of the Letter template to be rendered.

  • initialDataXML: XML data that will be used to initialize the data dictionary used in the letter, if any, and finally merged with the letter's layout after augmentation with the necessary control data for the letter's content.

    This XML data may be fetched from an external data source.

  • mergeDataOnServer: This parameter should be set to True to merge the relevant data into the letter. Should obviously be true for system generated correspondence.

  • useTestData: Specify whether to use test data for rendering. On a production system, this should be set as false. The given initialDataML is used instead.

  • renderInteractive: Specify whether to render an interactive or non-interactive (flat) PDF file.

Return Value

The API returns an object of type com.adobe.icc.render.obj.PDFResponseType, which can be used to extract the final rendered PDF content using PDFResponseType.getFile().getDocument().

// Ethnio survey code removed