Lexmark X925 Lexmark Document Distributor - Page 30

mergeContext, mergeContext field to which

Page 30 highlights

Developing workflow solutions 30 Assign callback functions to the following fields of the mergeContext top‑level object at the end of the main() function (or, when using exception handling, at the end of the try block within the function): mergeContext field to which the callback function is assigned Stage of forms merge at which the assigned function is called mergeContext.renderDataPage After each page of input data is read Parameters of assigned callback function page-DataPage object containing the data from the page mergeContext.endDoc mergeContext.endDataSet After input from a single form is completed and the resulting PDF is rendered fileName-String containing the path and file name of the output PDF After input from a single form is completed and the resulting dataset is generated Note: A dataset is generated only if this callback function is defined. fileName-String containing the path and file name of the dataset, which can be sent to a printer with a forms card mergeContext.endData After all input data is read None mergeContext.endJob After all PDFs included in the job have files-Array of strings containing the been rendered file names of all output PDFs A forms merge script with all callback functions defined is structured as follows: function main() { try { //Actions to take when job is first submitted ... //Assignment of callback functions mergeContext.renderDataPage = myRenderDataPageFunction; mergeContext.endDoc = myEndDocFunction; mergeContext.endDataSet = myEndDataSetFunction; mergeContext.endData = myEndDataFunction; mergeContext.endJob = myEndJobFunction; } catch(e) { //Logging and other exception handling ... throw e; } } function myRenderDataPageFunction(page) { try { //Actions to take after each page of data //is read from the input data ... } catch(e) { //Logging and other exception handling ... throw e; }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82

Assign callback functions to the following fields of the
mergeContext
top
level object at the end of the
main()
function (or, when using exception handling, at the end of the
try
block within the function):
mergeContext field to which the
callback function is assigned
Stage of forms merge at which the
assigned function is called
Parameters of assigned callback
function
mergeContext.renderDataPage
After each page of input data is read
page
—DataPage object containing the
data from the page
mergeContext.endDoc
After input from a single form is
completed and the resulting PDF is
rendered
fileName
—String containing the
path and file name of the output PDF
mergeContext.endDataSet
After input from a single form is
completed and the resulting dataset is
generated
Note:
A dataset is generated only if
this callback function is defined.
fileName
—String containing the
path and file name of the dataset, which
can be sent to a printer with a forms
card
mergeContext.endData
After all input data is read
None
mergeContext.endJob
After all PDFs included in the job have
been rendered
files
—Array of strings containing the
file names of all output PDFs
A forms merge script with all callback functions defined is structured as follows:
function main()
{
try
{
//Actions to take when job is first submitted
//Assignment of callback functions
mergeContext.renderDataPage = myRenderDataPageFunction;
mergeContext.endDoc = myEndDocFunction;
mergeContext.endDataSet = myEndDataSetFunction;
mergeContext.endData = myEndDataFunction;
mergeContext.endJob = myEndJobFunction;
}
catch(e)
{
//Logging and other exception handling
throw e;
}
}
function myRenderDataPageFunction(page)
{
try
{
//Actions to take after each page of data
//is read from the input data
}
catch(e)
{
//Logging and other exception handling
throw e;
}
Developing workflow solutions
30