Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

programatically controlling the stapler

Status
Not open for further replies.

John Walker

Programmer
Nov 10, 2016
9
CA
I'm trying to turn on the stapler for a print job and then reset it afterwards so future prints are not stapled.
I've spent months on this and need help.
Here's what I've got so far:
~%-12345X
@PJL SET OUTBIN=OPTIONALOUTBIN2
@PJL SET FINISH=STAPLE
@PJL SET STAPLEOPTION=ONEANGLED
@PJL ENTER LANGUAGE = PCL
~&l2A~&l1O
This is the report that I want to have stapled.
It could go on for several pages
bla bla bla
~%-12345X
@PJL SET OUTBIN=OPTIONALOUTBIN2
@PJL SET FINISH=NONE
@PJL SET STAPLEOPTION=NONE
~%-12345X~E

(Here, I'm showing ~ as the Escape character)

I'm using an HP M4555 MFP with the stapler option, and I've seen it work.
I get the report with just the text I expect (This is the report...), but with no staple, and it ends with the PJL code on the last page (where it has @PJL SET FINISH=NONE)

What am I doing wrong?

Thanks in advance!!
 
A PJL reference I found online uses a slightly different syntax, e.g.:
{
Ec%-12345X@PJL SET COPIES = 3 <CR> <LF>
@PJL SET RET = MEDIUM <CR> <LF>
@PJL SET PAGEPROTECT = OFF <CR> <LF>
@PJL ENTER LANGUAGE = PCL<CR> <LF>
EcE. . . .pcl job data. . . . .EcE
Ec%-12345X

}

There is a specific warning that there can be only <LF> and optionally <CR>
between the leading
Ec%-12345X
and the first @PJL sequence.
Beware of trailing spaces in the first line after Ec%-12345X ; stuff like that has bitten me many times.

The reference does not mention the trailing -E after the closing
Ec%-12345X
sequence.
Perhaps that is a newer enhancement.

No specific expertise claimed here.


 
According to the PJL Technical Reference manual:

The UEL command at the beginning of the job must be immediately followed by the PJL command prefix (@PJL).
No other characters, including control characters, are allowed between the UEL command and the @PJL prefix.


So the LineFeed characters following the 'X' of each of the Universal Exit Language sequences are technically invalid.

The <Esc>E escape sequence following the terminating UEL is also superfluous.

I've no idea whether or not the SET commands shown are valid for the target printer.
 
Yes, that worked.
~%-12345X@PJL SET OUTBIN=OPTIONALOUTBIN2
@PJL SET FINISH=STAPLE
@PJL SET STAPLEOPTION=ONEANGLED
@PJL ENTER LANGUAGE = PCL
&l2A~&s1C....report goes here....
~E

and the next report is not stapled by default.
Thank you so much!!
 
Now, when I print in Landscape, it doesn't staple at all.
I used PCL to go Landscape (~&l1O) but no staple.
I then tried to use PJL instead, but setting:
@PJL SET ORIENTATION=LANDSCAPE
it prints Landscape, but won't staple.
Is there another option I need to change at the same time?

~%-12345X@PJL JOB
@PJL SET OUTBIN = OPTIONALOUTBIN3
@PJL SET FINISH = STAPLE
@PJL SET ORIENTATION=LANDSCAPE
@PJL SET STAPLEOPTION = ONEANGLED
@PJL ENTER LANGUAGE = PCL
&l2A~&s1C . . . report . . .
~E ~%-12345X@PJL EOJ
@PJL RESET
~%-12345X
 
Follow-up: if I change the STAPLEOPTION to:
@PJL SET STAPLEOPTION = ONE (instead of ONEANGLED)
it does staple, but puts it in the upper right corner instead of the left corner, and is still angled.
This is not a big problem, but wondered how to get it in the upper left.
Could you please point me to a PJL tech manual that has this stuff in it?
I found some on the internet that don't have these options (they were from the HPLJ 5SI era).
I'm very familiar with PCL, but PJL is new to me.
 
I don't think that HP has published any general PCL or PJL technical manuals since the early/mid 1990s.

I did find some documentation regarding PJL commands for Stapling and/or Hole Punching with LaserJet M806/M830/M855/M880 devices - the PJL commands are quite different to the ones you are using,though.

You may be able to find device-specific documentation for your device - I don't know.
 
as a side note, would you happen to know how to access a Multi-function HP LaserJet printer's Faxing capability using PCL or PJL? I was hoping I could programmatically send a report to a printer, and use it's faxing capability to send it as a fax somewhere else, as our server has no dialing capability, but our MFP does.
 
>> ... would you happen to know how to access a Multi-function HP LaserJet printer's Faxing capability using PCL or PJL? ...

No idea, sorry.
I doubt that either of these 'languages' are anything to do with the faxing mechanism at all.
 
I don't know this multi-function printer, but the FAX function is probably accessed via a separate driver, not PCL or PJL.
 
Just a thought... you may want to set your paper orientation before the staple option... it could be that the staple option is getting reset when you change the orientation. <Shrugs>


Just my $.02

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Yes, I had thought of that, and it did make things better, but I think the problem might be that the printer can only staple in one fixed corner. Whether I print landscape, portrait or duplex, the staple is always in the same corner. But then, I haven't found a command to direct the printer to use a stapler in a different corner (if there is one)
 
And there may not be.... most of the staplers that I have seen (unless it's a saddle stapler) staples in one corner only. Rotating the page so that the upper-left corner of the printing is ejected physically closest to the stapler is all you can do in those cases.


Just my $.02

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
There is a "Reverse landscape" and "Reverse Portrait" that may do that... not sure... haven't played with PJL much.




Just my $.02

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Yes, it had an impact. It effectively staples on the bottom right corner now. For Landscape duplexed on the short edge, it is better than it was before. Not ideal, but better. But, Landscape duplexed on the long edge is bad. What I really need to do is print on the backs of the pages in reversed page order. I'm not sure if that is possible. I was really hoping the printer would be smart enough to figure it all out for me, and arrange the pages so that the stapler was where it is needed.
 
Don't forget in your settings to set:

@PJL SET FOLDSPINDLEMUTILATE = OFF
@PJL SET AUTOJAM = OFF

;)



Just my $.02

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
>> ... I haven't found a command to direct the printer to use a stapler in a different corner (if there is one) ...

The parameters to the PJL SET command appear to vary from model to model, and there doesn't seem to be much in the way of documentation available (the old PJL Technical Reference manual and Addendum haven't been updated for years).

You may (on some devices) be able to find out what parameters are relevant for certain PJL variables, by using status read-back features.
For example, with a local LaserJet Enterprise M553x printer:

Capture_w1ur1c.png


Note that, although it appears that the STAPLEOPTION variable is recognised, this particular printer does not have a stapler/stacker unit fitted, so the options are irrelevant - presumably the firmware supports the options for the situation where such a unit is fitted.

I've no idea whether or not your model would return the relevant data - you could try using the Status Readback tool in the PCL Paraphernalia application, available via [URL unfurl="true"]http://www.pclparaphernalia.eu[/url] in order to find out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top