[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1992
  • Last Modified:

PJL and PCL

Hi,

          We have LaserJet 4 Plus and need to:

           1) Read current printer's configuration
           2) Change configuration (font in particular) to print some documents
           3) Reset configuration back.

 How can I tell if our Unix system supports PJL or PCL, also which language could be more helpful in our case ?
 Some code samples would be greatly appreciated.

 Thank You,
 -Alex
0
AlexF777
Asked:
AlexF777
2 Solutions
 
hdhondtCommented:
We've got a number of issues here.

First of all unix does not "support" PCL, PJL or any other printer language. With unix this is all done by the application. The exception is an application called GhostScript. With GS you first create a PostScript file from your app (most unix apps support PostScript). Then GS post-processes that and converts it into commands for any of a large number of printers. Note that this still depends on a) your app supporting PostScript, and b) GS having drivers for your printer. Unix does not come into the equation.

PJL is not a really printer language. It is a set of commands to set a printer up before the printjob is sent (as either PCL or PostScript). Fonts are normally specified as part of the print job. However, PJL can be used to specify a default font, using:

Ec%-12345X@PJL DEFAULT LPARM : PCL FONTNUMBER=2
Ec%-12345X

This selects font #2, until the application selects a different one. (Ec stands for the escape character - decimal 27, hex 1B).

If all you want to do is changing default fonts, there is no need to read the printer's configuration. Simply send a PJL command to select the required font before the print job, and another one to select the original font back again after the print job. If there is anything else that needs doing, please be more specific.
0
 
wyliecoyoteukCommented:
Depends on your implementation of unix.

I use Linux to print to pcl printers, you can use LPRng or CUPS to do this.

If you want to change fonts, a print filter is simple to implement, if you know the commands.

For example, I use  cat <printercommandfile> - | sed -f <formattingscript>| lp -d <printername>
to insert PCL commands into the standard IO data stream.
This inserts the PCL commands in <PCLcommand file> into the IO, at the front, then edits the file using sed, then pipes it to the printer.

Without knowing more about your UNix implementation, It is difficult to be specific.
Also, if you want to use different fonts, be aware that most printer internal fonts other than courier, are Proportionally spaced, and this will mess up the spacing on an ASCII stream which is designed for fixed spacing.
Be aware that changing fonts requires specifying proportional or fixed, and if you specify fixed, you will usually only have courier as a font.

I would suggest searching for documentation on   cat, sed, awk, and grep.
Or if you are more ambitious, Tex.

The HP PCL technical reference is quite good, and you can download it as a PDF.
Some printers use their own subset of PCL for model-specific codes, plus their Font info may differ.
Most Printers will print out a list of fonts and their command codes from the user menus on the printer keyboard.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now