Adding staple command to existing postscript file to stitch print on Xerox Workcentre

I had to print a number of jobs on a Xerox Workcentre with staple on them, printing automatically on linux with the lpr tool. Origin: latex -> dvi -> postscript. Printing is fine, but without a staple.

I’ve checked the data transferred from a windows print and from that I got the needed options for the postscript file. I created a short perl script that reads the original postscript output of dvips and adds the stapling option into the postscript file directly. Output then can be sent to lpr.

Here is the script, I hope special characters are o.k.:

%%BeginFeature: *Stapling Single-Portrait
<< /Staple 3 /StapleDetails << /Type 1 /StapleLocation (SinglePortrait) >> >> setpagedevice

open(F2,$f) or die();
while ($s=<F2>)

if ($s=~ /^%%BeginSetup$/)
else {printf("%s",$s);


This entry was posted on May 8, 2017 at 10:51 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.