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.

    <field>%%beginstaple RA 
        <ref> '*' "%%BeginPageSetup"
        <loc> 0 -15 16
    <field>%%endstaple RA
        <ref> '*' "%%PageTrailer"
        <loc> 0 -12 13

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