On this Page
The Merge Algorithm
To generate the output, Merge performs the following steps:
- Load the form file into an internal Form DOM (Document Object Module).
- Process Filter script or process if specified. This enables translation of the input data prior to merging with the form.
- Process any "Start Job" event script. For information about the Merge events, see Merge Events.
- Open the data file - possibly altered by the Filter process above.
- For each document in the data file:
- Load the XML data for one document into the Data DOM.
- Process any "Start of Document" event script.
- Combine the Data DOM with the Form DOM to create the Document DOM. This includes replicating panes for which there are multiple instances of data elements within this document's Data DOM. See _data, _document.
- Process global fields to replicate their values to all instances within the document, see Global Fields.
- Replace each automatic field reference ($fieldname) in the form.
- Determine the actual size for all panes.
- Process any "End of Merge" event script.
Replace each embedded field reference (for example, [FieldName] within a text label string) with the corresponding field value. For more information, see Auto/Embedded Fields.
- Word-wrap all text fields, handle truncation and resize fields that overflow.
- Determine the actual size for all panes given that the fields are filled with data.
- Paginate the document. The processing to this point treats pages as though they can have an infinite height. In this step, any page that overflows is split between panes or within panes that are flagged as being allowed to be split across pages. The overflow is moved to a new overflow page. This process is repeated until all the panes fit properly on all pages. See Pagination.
Whenever a new page is inserted, overflow footer panes may be inserted at the bottom of one page and overflow header panes may be inserted at the top of the next page. Also on the newly inserted page, footer panes and header panes are processed to make sure that the values for any global fields are replicated and auto/embedded fields are resolved. - Process any "End of Paginate" event script.
- Process any "Ready to Print" event script.
- Perform a final word-wrap check to catch any fields that were altered in the previous script.
- Print the document - for each print driver do the following:
- Stretch vertical lines to reach the bottom of pane if applicable.
- Process text labels that contain a "Page N of M" type embedded field, as the number of pages in the document is now known.
- Apply field formatting (date, currency, etc.).
- Process any "Start next Print Driver" event script.
- Establish the output location. Merge can create a single output file for all documents or a different output file for each document.
- Insert "blank" pages where necessary - this is usually to allow for proper printing of a duplexed document. Some pages are always to appear on the front side of the sheet of paper. To cause that to happen an additional page may have to be inserted.
- Render all pages to the output: to a PDF, a printer or a disk file.
- Terminate the document; close the open output file when individual files are required for each document.
- Update the summary variables for the document and page counts. These updated page and document counts are available in the script engine. Script can be added to the "End of Document" event to store this information for later use by the Start of Summary script event.
- Process any "Start of Summary" event script. This script can create a summary data file that is used for summary printing.
- Process any summary data supplied in the previous step. This results in a full "document merge" of the summary data with the form using only those Panes whose Job Section has been set to "Summary".
- Process any "End of Job" event script.
- Process "Finalize" event script.
- End of processing; exit Merge.
Word-Wrapping
Word wrapping is reprocessed when changes to text are made.