1

I am using the printer HP LaserJet 5000 Series PCL6. Trying to set print attributes like copies and orientation using PJL. Using PostScript as the underlying job language. I am using LPR command (lpr -S{IP} -P{IP} test.txt) to run the below code to print from windows. The printer does not print any content at all. If i remove the PJL specific commands and just run the PS alone, the content is printed correctly. Is there anything that i am missing?

     Ec%-12345X@PJL SET COPIES = 3
     @PJL ENTER LANGUAGE = POSTSCRIPT
     %!PS-Adobe-3.0
     %% Example 1

     newpath
     100 200 moveto
     200 250 lineto
     100 300 lineto
     2 setlinewidth
     stroke
     showpage ^D Ec%-12345X

I also tried using <ESC> in the place of Ec.

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Rachel
  • 763
  • 14
  • 29

1 Answers1

1

Ec and <ESC> are both incorrect. You need the actual ASCII code for ESC which is ASCII character 27.

The easiest way is:

char esc = 27;

and you can then incoroporate that as needed

barrowc
  • 10,444
  • 1
  • 40
  • 53
  • Great!! It works. I am able to set the number of copies and get it printed. However the below attribute does not work, @PJL SET ORIENTATION=LANDSCAPE. I am also looking for options to print particular page range say from page 2 to 5. Is this possible? – Rachel Nov 10 '10 at 16:34
  • Not aware of any way to only print specified pages (this is really the responsibility of the application sending the data rather than the printer). Not sure why setting the orientation failed - it does need to be on a line of its own: `@PJL SET ORIENTATION = LANDSCAPE` where represents the newline character(s) on your system. Alternatively look at using PCL for that – barrowc Nov 11 '10 at 00:34
  • Yes i had the new line included but still in vain. The actual print content is a PostScript. I doubt if orientation can be modified by just setting in PJL with no change in PS. – Rachel Nov 12 '10 at 03:52