Bug 696314 - Add PJL to staple documents
Add PJL to staple documents
Product: Ghostscript
Classification: Unclassified
Component: PXL Driver
PC All
: P4 enhancement
Assigned To: Henry Stiles
Bug traffic
: bountiable
Depends on:
  Show dependency treegraph
Reported: 2015-10-30 08:23 UTC by M
Modified: 2016-04-25 08:29 UTC (History)
1 user (show)

See Also:
Word Size: ---

adding the Staple option. (3.39 KB, patch)
2015-10-31 05:08 UTC, Hin-Tak Leung
Details | Diff
rebased patch (3.78 KB, patch)
2016-02-23 16:34 UTC, Hin-Tak Leung
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description M 2015-10-30 08:23:19 UTC
It would be jolly nice if you could generate PCL documents which included the PJL to turn on the stapler.

I've had success doing this by post-processing ghostscript's output with Perl:
   $pcl =~ s/(\@PJL)/\@PJL SET FINISH=STAPLE\n$1/;

However, this seems a tad messy. It would be nicer to just add code to emit

One way to present this to the user would be a command line switch e.g.
-jFINISH=STAPLE, but perhaps it would be better to expose a more general
interface to allow arbitrary PJL to be included. Alternatively, perhaps
a more specific -staple option would be better.

Some printers allow more control over the staple position and orientation.
This can also be controlled with PJL, but I don't know the details, nor if
it's a manufacturer specific issue.
Comment 1 Henry Stiles 2015-10-30 08:49:23 UTC
We'd like the pxl devices to support setpagedevice staple.  We do not want to pass arbitrary PJL through the command line.  Making this a bountiable enhancement for the pxl device.
Comment 2 Hin-Tak Leung 2015-10-31 05:08:58 UTC
Created attachment 12034 [details]
adding the Staple option.

This patch adds the Staple option, used the same way as the other options like Tumble and Duplex e.g.

gs -dStaple  -sDEVICE=pxlcolor -o withStaple.pxl examples/tiger.eps
Comment 3 Henry Stiles 2016-02-23 16:07:43 UTC
Sorry for the delay Hin-Tak.  This looks okay, I'd prefer a git format-patch against the current code.  

I don't know if you've noticed but the bounties have increased (doubled).
Comment 4 Hin-Tak Leung 2016-02-23 16:34:34 UTC
Created attachment 12348 [details]
rebased patch

rebased patch to current code base. Works the same way.
Comment 5 Henry Stiles 2016-04-25 08:29:06 UTC
Fixed here:

commit dca281c3d8011a2afe3caadc23009fe38d8df839
Author: Henry Stiles <henry.stiles@artifex.com>
Date:   Mon Apr 25 09:21:24 2016 -0600

    Bug 696314, Add PJL to staple documents.

    Staple setting for the PXL devices courtesy of Hin-Tak Leung.