How to add stapling directives to the output PDF using Enrichment

Product Feature: PDF Print Stream Input Type

 
The control file below is an example on how to add stapling directives.  This control file will insert staple commands before each %%BeginPageSetup and after each %%PageTrailer
but the exact place to do so, could be changed, and the contents of the staple command could be changed too based on the exact requirement.  Also, you will presumably want logic to determine when to insert the commands.



<input>
    <name>zzz
    <type>S
    <file>c:\qa\engine\ps\2173799.ps  
    <field>%%beginstaple RA 
        <ref> '*' "%%BeginPageSetup"
        <loc> 0 -15 16
    </field>
   
    <field>%%endstaple RA
        <ref> '*' "%%PageTrailer"
        <loc> 0 -12 13
    </field>
</input>
<output>
    <name>out
    <file>'DDOUTPUT1.ps'
    <duplex>No
</output>

<rule>
  <Content>
    %%beginstaple = "<</Staple 3 /StapleDetails << /Type 1 /StapleLocation (SinglePortrait) >> >> setpagedevice" | x'0d0a' |
                    %%beginstaple
    %%endstaple = %%endstaple | x'0d0a' | "<</Staple 0 >> setpagedevice"
  </content>
</rule>
              
 
UPDATED:  May 26, 2020