On this Page

    The Merge Algorithm

    To generate the output, Merge performs the following steps:

    1. Load the form file into an internal Form DOM (Document Object Module).
    2. Process Filter script or process if specified. This enables translation of the input data prior to merging with the form.
    3. Process any "Start Job" event script. For information about the Merge events, see Merge Events.
    4. Open the data file - possibly altered by the Filter process above.
    5. For each document in the data file:
      1. Load the XML data for one document into the Data DOM.
      2. Process any "Start of Document" event script.
      3. 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.
      4. Process global fields to replicate their values to all instances within the document, see Global Fields.
      5. Replace each automatic field reference ($fieldname) in the form.
      6. Determine the actual size for all panes.
      7. Process any "End of Merge" event script.
      8. 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.

      9. Word-wrap all text fields, handle truncation and resize fields that overflow.
      10. Determine the actual size for all panes given that the fields are filled with data.
      11. 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.
      12. Process any "End of Paginate" event script.
      13. Process any "Ready to Print" event script.
      14. Perform a final word-wrap check to catch any fields that were altered in the previous script.
      15. Print the document - for each print driver do the following:
        1. Stretch vertical lines to reach the bottom of pane if applicable.
        2. Process text labels that contain a "Page N of M" type embedded field, as the number of pages in the document is now known.
        3. Apply field formatting (date, currency, etc.).
        4. Process any "Start next Print Driver" event script.
        5. Establish the output location. Merge can create a single output file for all documents or a different output file for each document.
        6. 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.
        7. Render all pages to the output: to a PDF, a printer or a disk file.
        8. Terminate the document; close the open output file when individual files are required for each document.
      16. 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.
    6. Process any "Start of Summary" event script. This script can create a summary data file that is used for summary printing.
    7. 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".
    8. Process any "End of Job" event script.
    9. Process "Finalize" event script.
    10. End of processing; exit Merge.

    Word-Wrapping

    Word wrapping is reprocessed when changes to text are made.