There are 2 principle ways to handle this:

So have first a look into the easier way:

OutPort method:

The trick is to split the file to the same or second queue, in a way that it is reprintable. Each single job is arriving again in ELP, so it can be treated as whished.

  1. Split the job into a second queue. This method is setup using the Rule assistant ->Job Splitting menu.

    This first example assumes, that the print job is based on just one single page per document

    [Name of second queue arriving the split parts]

    ; here you may do whatever needs to be done, either change into another config file
    ; This queue has the sharename ELP_OUT

    IniFile =#ELP_FORMS_PATH#SplitFiles.ini

    ; or: if all commands can directly be done here in that automatic triggered rule like
    ; ELP_Command =K3;T200;
    ; then do not forget to use the
    ; EXIT=ON< ; command to prevent from processingthe next rule again

    [Name of the queue receiving the mailmerge job]

    ; sent job (split to the second queue (above)

    OutPort=\\#HOSTNAME#\ELP_OUT

    ; do not use the next key, if the application creates every document self printable. (Downloads again all needed fonts etc.)

    OutPortMode_CollectFonts=ON

    ; every single page needs to be split

    SplitEveryPage=ON

  2. Split the job into a second queue. This method is setup using the Rule assistant Job Splitting menu.

    This second example assumes, that the print job is based on fixed N pages per document

    [Name of second queue arriving the split parts]

    ; see above

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini

    [Name of the queue receiving the mailmerge job]

    OutPort=\\#HOSTNAME#\ELP_OUT
    OutPortMode_CollectFonts=ON

    ; On every third page the split command is inserted and the page cpounter is reset to 0

    ELP_COMMAND=C1:2F25997R0;

  3. Split the job into a second queue. This method is setup using the Rule assistant -> Job Splitting menu.

    This example assumes, that each single document of the mail merge job can have different amount of pages

    [Name of second queue arriving the split parts]

    ; see above

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini

    [Name of the queue receiving the mailmerge job]

    OutPort=\\#HOSTNAME#\ELP_OUT
    OutPortMode_CollectFonts=ON

    [Split the file on each last page]

    ; if yes, then this text is always found on the last page:

    Search_Windows_New=Any text on last page of mailmerge document

    ; Add the command for splitting at next form feed

    Add_Binary=\x1B)s-997Z
    ReadOnlySearchKeys=ON

  4. Same as last above, but the split argument is found on each first page

    [Name of second queue arriving the split parts]

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini
    Preparsing=ON

    [Name of the queue receiving the mailmerge job]

    OutPort=\\#HOSTNAME#\ELP_OUT
    OutPortMode_CollectFonts=ON

    [Split the file on previous pages]

    Search_Windows_New=Any text on each first page of mailmerge document

    ; Add the command for splitting at next form feed

    InsertOnPreviousPage=\x1B)s-997Z
    ReadOnlySearchKeys=ON

    Note: PreParsing needs to be set to ON for that, in rule global!


    Another example where the document is split, when a customer number changes;

    [Global]

    ; Preparsing is needed, as there the page numbering is set

    Preparsing=ON

    ; Set the default value

    Variable=#LastCustNo#:0000

    ; make primary trigger below always true

    SetTrigger=1:ON

    [Search for Customer Number]

    ; if found

    Search_binary=Kundennummer

    ; then

    StoreNextWordToVariable=#ActCustNo#

    ; and after it is read, do the check with next rule

    TriggerSectionAfterStore=Compare Cust No

    [Compare Cust No]

    ; Primary trigger is always true

    Trigger_Binary=1

    ; but if the last customer number does not match the actual one

    Trigger_Variable=#LastCustNo#!#ActCustNo#

    ; then save new customer number

    Variable=#LastCustNo#:#ActCustNo#

    ; and add the split command on the last page

    InsertOnPreviousPage=\x1B)s-997Z

    Limitations for command: InsertOnPreviousPage and InsertOnTopOfPage

    • Only page breaks with Form Feeds are counted
    • Pages are counted using the Preparser! Meaning inserting new pages with other commands then the ELP_Command FF are NOT noticed and will result into wrong output
    • Dito removing or combining pages.
    • As seen in the second example, the two command can be used in trigger sections as well, but with sense only if they are directly executed on a found Search event.
    • Under specific conditions, this will NOT work with Search_xxx_new executed rules
    • You may use the key several times in a rule or in different rules, even working on the same page. The insertion is then done using the LIFI principle.

     

  5. Split the job only if there are minimum 2 documents in the file.

    [Global]

    ; Init var

    Variable=#MyDocumentCounter#:0
    SetTrigger=1:ON

    [Name of second queue arriving the split parts]

    ; same as above

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini

    [Is this the mail merge document]

    Search_Windows_New=Any text on last page of mailmerge document
    Add_Binary=\x1B)s-997Z

    ; and set the semaphore to true

    Counter=#MyDocumentCounter#

    [Finally set the split command if more then one docuemnt]

    ; Primary Trigger always true

    Trigger_Binary=1

    ; and if more then one document

    Trigger_Variable=#MyDocumentCounter#>1

    ; then split:

    OutPort=\\#HOSTNAME#\ELP_OUT
    OutPortMode_CollectFonts=ON

  6. The same example as above, but ELP searches for a text on each first page (here Page No: 1)

    [Global]

    ; Enable the preparser to detect the page breaks

    Preparser=ON

    ; Init var

    Variable=#MyDocumentCounter#:0
    SetTrigger=1:ON

    [Name of second queue arriving the split parts]

    ; same as above

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini

    [Is this the mail merge document]

    ; to differentiate between page 1 and 11 or any page from 100 to 199
    ; the last Blank is searched as well, this is why the searched argument
    ; is surrounded by "".
    ; Here the numbering was done with 1 of X,

    Search_Binary="Page No: 1 "
    InsertOnPreviousPage=\x1B)s-997Z
    Counter=#MyDocumentCounter#

    [Finally set the split command if more then one docuemnt]

    Trigger_Binary=1
    Trigger_Variable=#MyDocumentCounter#>1
    OutPort=\\#HOSTNAME#\ELP_OUT
    OutPortMode_CollectFonts=ON

    If the page counter is just only 1 2 3 and no space sign behind, then you may search for the next character as well, like:

    ; Next character is an Escape sign, or \x0D for Carriage Return or \x0A for line feed

    Search_Binary=Page No: 1\x1B

     

    You may also search and evaluate like this:

    [Is this the mail merge document]

    Search_Binary=Page No:
    StoreNextWordToVariable=#testvar#
    TriggerSectionAfterStore=Test if page 1

    [Test if page 1]

    ; Primary trigger always true

    Trigger_Binary=1

    ; Secondary is maybe true, at least for all first pages

    Trigger_Variable=#testvar#:1
    InsertOnPreviousPage=\x1B)s-997Z
    Counter=#MyDocumentCounter#

  7. Split the job in into the same queue, in order to save money on licenses

    [Detect the second run = split document]

    Search_Binary=@PJL COMMENT "secondrun"

    ; then again same as above, note this will be seen right at the beginning of the job

    IniFile=#ELP_FORMS_PATH#SplitFiles.ini

    [Split the file on each last page]

    Search_Windows_New=Any text on last page of mailmerge document
    Add_Binary=\x1B)s-997Z
    ReadOnlySearchKeys=ON

    [Split the job]

    ; Primary Trigger always true, and the rule will only be done on the first pass, as second will be sorted out above in other ini file

    Trigger_Binary=1

    ; sent job (split) to same queue

    OutPort=\\#HOSTNAME#\#PRINTERSHARENAME#
    OutPortMode_CollectFonts=ON

    [add marker that this is a split document]

    ; Assuming the job is well PJL bounded

    OutSearch_Binary=\x1B%-12345X

    ; Add the marker

    Add_Binary=@PJL COMMENT "secondrun"\x0D\x0A
    ReadOnlySearchKeys=ON

See also: Stapling/punching and splitting mail merge documents and also for more samples and technical information here.

OutArchiveDir method:

Splitting files directly in thearchive is pretty the same compared to last the OutPort method above. Just add to the OutArchiveDir key the info to split as well, using the key OutArchiveSpiltFiles=ON. Depending upon the PDF_Mode key, the files can even automatically converted into the PDF format.

  1. Using no particular file names:

    [Split the file on each last page]

    Search_Windows_New=Any text on last page of mailmerge document
    Add_Binary=\x1B)s-997Z
    ReadOnlySearchKeys=ON

    [Split the job in Archive]

    Trigger_Binary=1
    OutArchiveDir=#ELP_FORMS_PATH#Archive;SplitFile
    OutPortMode_CollectFonts=ON
    OutArchiveSPlitFiles=ON

    In order to generate unique archive file names, ELP adds the underline character plus a unique stip number, starting with 1 and ending with the last split part:
    SplitFile, SplitFIle_1, SplitFIle_1, etc.

  2. Each document part gets a unique file name

    Just a little more complex is the combination of archiving a larger incoming data stream into its parts using file names based upon data entries. The problem is, that all keys search_Binary, _Windows and _Text which may trigger the key StoreNextWordTo[Int]Variable are performed during reading the data stream. As writing out is processed much later, the variable used in the archive file are then named very likely as last found variable. Which results in all the same file names instead as expected each file named after the last invoice number.

    Reading the variables using the OutSearch_xxx key in conjunction with the StoreNextWordTo[Int]Variable key does holed always the latest processed entries for the actual document part:

    [Split the file on each last page]

    Search_Windows_New=Any text on last page of mailmerge document
    Add_Binary=\x1B)s-997Z
    ReadOnlySearchKeys=ON

    [Split the job in Archive]

    Trigger_Binary=1
    OutArchiveDir=#ELP_FORMS_PATH#Archive;#MyDocumentName#
    OutPortMode_CollectFonts=ON
    OutArchiveSPlitFiles=ON

    [Get the document name for each part]

    OutSearch_Windows=Invoice No:
    StoreNextWordToVariable=#MyDocumentName#
    ReadOnlySearchKeys=ON

  3. If the split parts should be stored in PDF Format, add to the rule containing the OutArchiveDir those two keys:

    PDF_Mode=20

     

Related articles: Archiving, Job splitting