Standard Rendering Service Commands
1. Introduction
The topics described in this document relate to Rendering Service tasks only.
Rendering Service enables processes to perform part of their rendering logic in an application running separately from priint:suite and priint:bpm. Processes can specify one of a number of different commands that instruct the worker what to do, which variable to expect and what outcome variables to add to the variable map as a result.
2. Commands
Supported commands for priint:pdf renderer and Adobe InDesign Server® are as follows (explained later):
Command | Execute Script | Export Document to PDF | Generate Document's Metadata and Preview | Register in Database |
---|---|---|---|---|
SCRIPT_PDF_META_DB | ✓ | ✓ | ✓ | ✓ |
SCRIPT_PDF | ✓ | ✓ | ||
✓ | ||||
SCRIPT_META_DB | ✓ | ✓ | ✓ | |
SCRIPT_DB | ✓ | ✓ | ||
SCRIPT | ✓ | |||
GRID_ELEMENT_PREVIEW | ✓ | |||
FIRE_AND_FORGET_SCRIPT_PDF | ✓ | ✓ |
Only for Adobe InDesign®
Command | Adobe InDesign® package | Includes Links and Fonts |
---|---|---|
IN_DESIGN_DOC_EXPORT | ✓ | ✓ |
3. Assigning task
To assign some Task to a Rendering Service:
Add a Service Task to a diagram and select it.
3.1. General Tab
- set its Implementation to External (Delegate Expression is not used)
- set its Topic to priint-rendering
- Asynchronous Continuations - do not set
- Documentation is a description for a Service Task
3.2. Definition Tab
In case of priint-rendering Topic user should not use this tab.
3.3. Input/Output Tab
Input/Output parameters differ depending on which Topic user set.
Note:
Parameter forceRefreshComponent set to true is automatically added.
3.4. Input Parameters for priint-rendering
First step is to choose which command is used for the Service Task.
- set Local Variable Name to renderingWorkerCommand
- set Variable Assignment Type to String or Expression
- set Variable Assignment Value equal to one of the five commands of your choosing, for example SCRIPT_META_DB.
Local Variable Name | Type | Example | Description |
---|---|---|---|
renderingWorkerCommand | String or Expression | the command to execute |
In the second step, the variable map at that point in the process contains all variables the selected command needs (listed below). If those variables are not set at the start of the process and they are not added by the service and user tasks leading to this point in the process, values can be set directly in the Input/Output -> Input Parameters section.
Parameters set in Input/Output Tab has higher priority and will override parameters incoming from previous steps.
A few are required by all commands:
Local Variable Name | Type | Example | Description |
---|---|---|---|
project | String or Expression | aio | id of the project for which the process runs |
As for the command specific variables, those are:
Command name | Local Variable Name | Type | Example | Description |
SCRIPT_PDF_META_DB | recreateDocument | String or Expression | true/false | if true, the document will get recreated |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
pdfProfiles | List | Value: High, Value: Low | a List of Strings naming the pdf profiles to use for rendering, // | |
startingPageParameterName | String or Expression | pageCountParam | ID of the parameter name for page countIf set, worker will assume page renumbering takes place in the process and will add a variable holding current document page count to the output | |
documentPageCounts | Map | Key: documentId Value: 122541 | a map of documentIds processed before the current one and their page counts. If it is not passed, the worker simply assumes this is a first document in a sequence | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
SCRIPT_PDF | recreateDocument | String or Expression | true/false | if true, the document will get recreated |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
pdfProfiles | list of strings | Value: High, Value: Low | a List of Strings naming the pdf profiles to use for rendering | |
scriptId | String or Expression | 2343 | id of a script to run | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
pdfProfiles | list of strings | Value: High, Value: Low | a List of Strings naming the pdf profiles to use for rendering | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
SCRIPT_META_DB | recreateDocument | String or Expression | true/false | if true, the document will get recreated |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
SCRIPT_DB | recreateDocument | String or Expression | true/false | if true, the document will get recreated |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
SCRIPT | recreateDocument | String or Expression | true/false | if true, the document will get recreated |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
IN_DESIGN_DOC_EXPORT | documentId | String or Expression | 1234567 | identifying the document to process |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
GRID_ELEMENT_PREVIEW | realGridElementIdentifier | String or Expression | cb407b95-5a68-499e-a80c-bfdebb5eab21 | an identifier of the RGE to preview |
masterdocumentpath | String or Expression | \userdata\documents\ aio\master_documents\ 902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
documentId | String or Expression | 1234567 | identifying the document to process | |
documentpath | String or Expression | \userdata\documents\aio\939668362 | a full path to the document files as perceived by the plannerengine | |
realGridElementUpdatedOnTimestamp | String or Expression | 2024-02-05 22:28:51.575 | Last RGE modification date in yyyy-MM-dd HH:mm:ss.SSS format | |
xTopLeft | String or Expression | 101 | top left RGE corner X coordinate | |
yTopLeft | String or Expression | 102 | top left RGE corner Y coordinate | |
xBottomRight | String or Expression | 201 | bottom right RGE corner X coordinate | |
yBottomRight | String or Expression | 302 | bottom right RGE corner Y coordinate | |
FIRE_AND_FORGET_SCRIPT_PDF | pdfProfiles | list of strings | Value: High, Value: Low | a List of Strings naming the pdf profiles to use for rendering |
masterdocumentpath | String or Expression | \userdata\documents\aio\master_documents\902010.w2ml | a full path to the master document file as perceived by the plannerengine | |
scriptId | String or Expression | 2343 | id of a script to run | |
outputFolder | String or Expression | \userdata\documents\aio\rendering_output_folder | folder rendered PDFs should end up in | |
outputFilenamePrefix | String or Expression | rendered_ | filename prefix rendered PDFs will use |
4. Outcome
Commands differ in their outcome:
Command | Outcome description |
---|---|
SCRIPT_PDF_META_DB | Removes the document file if requested. If the document file or its metadata are missing, it recreates them from the master document provided. If a script id is provided, it executes the script and saves the document. It then exports the document to a pdf for each pdf profile provided (or for no profile if none were given). The outcome files are named using the document identifier and pdf profile name and placed next to the document file. It then recreates the document metadata and previews and registers it in a database. It returns the number of pages the document has, adding them to a map held in a variable documentPageCounts allowing pagination page number adjustments for any subsequent documents. |
SCRIPT_PDF | Removes the document file if requested. If the document file or its metadata are missing, it recreates them from the master document provided. If a script id is provided, it executes the script and saves the document. It then exports the document to a pdf for each pdf profile provided (or for no profile if none were given). The outcome files are named using the document identifier and pdf profile name and placed next to the document file. |
Exports the document to a pdf for each pdf profile provided (or for no profile if none were given). The outcome files are named using the document identifier and pdf profile name and placed next to the document file. | |
SCRIPT_META_DB | Removes the document file if requested. If the document file or its metadata are missing, it recreates them from a master document provided. If a script id is provided, it executes the script and saves the document. It then recreates the document metadata and previews and registers it in a database. |
SCRIPT_DB | Removes the document file if requested. If the document file or its metadata are missing, it recreates them from a master document provided. If a script id is provided, it executes the script and saves the document. It then registers the document in a database. |
SCRIPT | Removes the document file if requested. If the document file or its metadata are missing, it recreates them from a master document provided. If a script id is provided, it executes the script and saves the document. |
IN_DESIGN_DOC_EXPORT | An Adobe InDesign® package is exported for the document in a form of a zip archive and it is placed next to the .indd document file. |
GRID_ELEMENT_PREVIEW | It executes the script specified by scriptId. It then extracts a preview of a comet group returned by that script and saves it in document metadata grid preview folder. It also removes older versions of that real grid element previews. |
FIRE_AND_FORGET_SCRIPT_PDF | Opens a temporary copy of a document template passed to it. It executes the script specified by scriptId. It then exports the document to a pdf for each pdf profile provided (or for no profile if none were given). The outcome files are placed in an output folder specified in the variables. |
5. Error Handling
If everything worked fine, a variable errorCode with a value 0 is set. If there were business errors, a variable errorCode with a non-zero value is set and an additional variable named errorMessage is added with an error description. If a technical error occurs, the process engine is notified with a BPMN error containing code RENDERING_FAILURE and an error description. A process can handle these using Error Boundary Events placed at the service task's boundary.
6. Summary
As all commands add some values to the process variables map, be sure to either:
A. run the rendering-service task once only
B. run the rendering-service task sequentially for documents, not in parallel, by setting the sub-process execution mode to Sequential Multi Instance
C. include all rendering-service task return variable names in sub-processes Input/Output ->Input Parameter section
Option A is most likely fine for single document processes. Options B and C should work for working with whole folders or publications and performing rendering for each document in a sub-process.