All PCL Command Sequences begin with the escape character (an ASCII control code with a hex value of 1Bh, 27 decimal) and end with the first upper case letter (or "=" note: "@" is considered an uppercase letter). In between there is either nothing (the PCL command is just the escape and a single upper case letter) or a set of one or two characters and often a numerical value. The single character commands are listed at the end of the "Decoded PCL Commands" table below. The first non-uppercase character after the escape will be a symbol between "!" and "\" (most commonly one of %,&,( or *) which is called the "parameter." After the parameter there is normally a lower case letter called the "group." After this there may be a numeric value. If no value is present, the value is assumed to be zero. Finally the ending uppercase letter is called the "command."
See Examples, Tutorials below for some samples of PCL commands and the Decoded Commands List for detailed information. Note that these use the text "Ec" to mean the escape character. Since the escape character is not printable, it is very hard to convey in human readable text. Common abreviations are Esc, Ec, [], or <-. See the ASCII page for more information on the codes. That page also allows you to convert between hex, decimal or ASCII codes.
ASCII control commands and HPGL (after PCL command to enter HPGL mode) are also acceptable in PCL 5. Printers that support PJL (Laserjet 4 and later) should be told to use PCL should be entered via the PJL ENTER LANGUAGE command.
Most of the problems people have with PCL are caused by not being aware of all the codes that are being sent to the printer and how they interact. Application programs, the language engine under the application, operating system printer drivers, network print que, and any number of other things will add codes to the print job before it reaches the printer and can cause the printer to behave in ways that are not expected. To understand why the printer prints as it does, you need to see what it saw.
There is a code that will allow you to see what is actually being recieved by the printer. Send esc&s0CescY to the printer before you print your problem job or as the first codes in the problem job. This command tells the printer to print all following commands rather than excecute them. You will get very funny looking printouts, but if you "decode" them by looking at each PCL command that the printer recieved and learning what it does (see the list below), you will begin to understand why the printer printed what it did.
If you don't see any change after sending these "debug" codes before your main job, your network connection may be resetting the printer between jobs. You may need to move the printer to a local parallel port connection to debug the problems. When you do see the print codes and you want to return the printer to normal operation, you must cycle the printer power to get the printer out of this debug mode.
char type |
bits to store |
max range | known (commonly used) values | |
---|---|---|---|---|
from | to | |||
parm | 4 | 21h | 2Fh | %,&,(,),* except for 9, E, Y, Z, and = which are considered commands (two character - no parm, group, or value) but come directly after the escape. |
grp | 4 | 60h | 7Eh | a,b,c,d,f,l,p,r,s,t,u,v |
value | 15-16 | -32767 | +65535 | will be either 0 to 32767, -32767 to +32767, or 0 to 65535. May have a decimal. |
cmd | 5 | 60h | 7Eh | a,b,c,d,e,f,g,h,l,m,n,o,p,q,r,s,t,u,v,x,y,z When another value and cmd will be sent for the current parm and grp. |
40h | 5Eh | @, A,B,C,D,E,F,G,H,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z When this is the last value and cmd for the current parm and grp |
||
parm: <!...\>?. group: <`...~>?. digits: <0...9>?. number: digits | '.' | digits ?. | ?. value: | sign number ? | number ? esc | parm | group [ value | lowercase? command ? PCLParmCmd ] | 'W' @+value ? PCLParmCmd . | uppercase? command ? PCLParmCmd . | '=' ? PCLSingleCmd . | '9' ? | 'E' ? | 'Y' ? | 'Z' ? | error .
See:
See also:
/techref/language/pcl/index.htmHi, guys. My first time asking, please don't shoot me for nubishness.
I am parsing some PCL5 and I ran into some peculiar stuff:
1) embeded data with no command preceding it, usually hex 20es, like: "1b 2a 70 38 39 32 58 25 26 27 28 29 27 24 2a 2b 29" - here you can see a horisontal cursor movement command, but right after x58 I get a string of 20es, related apparently to nothing.
What is this stuff and is there a way to predict it lengthwise? My guess was content to be drawn right after a movement, but I would like to predict it's appearance to parse it properly.2) Sometimes I get a x0d byte at the end of embeded data, like so: "1b 2a 76 36 57 00 01 08 08 08 08 0d"
Sometimes it's on the end of unpredicted data I mentioned in 1), like so: "1b 2a 70 31 38 33 32 58 29 27 24 2e 2f 30 24 0d"
It appears other places too, like right after exit from PJL and entrance to PCL following the x0a(newline) byte, like so(PJL is ascii for clarity): "@PJL ENTER LANGUAGE=PCL 0a 0d".
What is this byte for and can I predict it's appearance?
James Newton of Massmind replies: x0d is a carriage return. The stuff in the 20's are ASCII control characters. See: ASCII+
C program to convert a pcl image file to text for editing and to convert the edited text file to a pcl image file again.
Questions:
Hello,
I'm trying to utilize PCL and macros to get a report to print correctly. Basically, I have 1 Logo image (which I used ImageMagick to convert to PCL from a BMP), I have 1 barcode PCL file (that I generated via a program I wrote which draws rectangles for each bar) and obviously the report itself). My intention was to simpley dump the logo and barcode PCL files into a single PCL file, wrap them with a macro, and enable macro overlay right before printing report. My problem is, upon doing this I end up with 2 pages. 1 with only the Logo, and 1 with the barcode/report. I've tried hand altering the pcl file to get it correct, however, the converted/logo file doesn't look like standard pcl, looks like binary garble. I also found that hand creating a pcl logo wrapped with macro commands will immediately print once submitted to the printer, even without me executing the macro, it's almost as if something in the logo/pcl/binary/garble is triggering the printer to print/mis-interpret the data stream. Any idea what could be causing my macro to basically page break mid print? I can provide samples etc.. if you can respond with an email address I can send samples to. Thanks for any assistance you can provide.
James Newton of MassMind replies: Your problems are many...
I have a program that produces non-paged, relative position, easily combined PCL image macros, but I can not sell or release it. Send me the logo and $20 and I'll process it for you.+
Hi, guys. My first time asking, please don't shoot me for nubishness.I am parsing some PCL5 and I ran into some peculiar stuff:
1) embeded data with no command preceding it, usually hex 20es, like: "1b 2a 70 38 39 32 58 25 26 27 28 29 27 24 2a 2b 29" - here you can see a horisontal cursor movement command, but right after x58 I get a string of 20es, related apparently to nothing.
What is this stuff and is there a way to predict it lengthwise? My guess was content to be drawn right after a movement, but I would like to predict it's appearance to parse it properly.2) Sometimes I get a x0d byte at the end of embeded data, like so: "1b 2a 76 36 57 00 01 08 08 08 08 0d"
Sometimes it's on the end of unpredicted data I mentioned in 1), like so: "1b 2a 70 31 38 33 32 58 29 27 24 2e 2f 30 24 0d"
It appears other places too, like right after exit from PJL and entrance to PCL following the x0a(newline) byte, like so(PJL is ascii for clarity): "@PJL ENTER LANGUAGE=PCL 0a 0d".
What is this byte for and can I predict it's appearance?
James Newton of Massmind replies: x0d is a carriage return. The stuff in the 20's are ASCII control characters. See: ASCII+
"we can create a macro for you given the logos or other text, etc.. you wish to see on the page.+"
THANK YOU for offering to make a macro and code for me. I simply want to put a header (letterhd.bmp) and a footer (letterft.bmp) as an overlay on the top and bottom of a DOS program printer output (ie letterhd on top, then the letter, then letterft on the bottom). I need to the macro to bring in the header - allow the letter, then bring in the footer - which are .bmp files. THANK YOU!
I would like to put a letterhead and a footer graphic as an overlay on a dos output letter(.bmp, but I can convert to any format). Please tell me how to do this; the dos program allows sending an initial and ending file command for letter printing, as well as a few custom entered esc sequences during the printing. Thank you!!
James Newton of Massmind replies: You would need to make a PCL Macro file with the commands to draw the letterhead and footer inside it (see Macros). If your graphic includes a bitmaped logo, you will need to include that as PCL commands (See Bitmapped Pictures). The completed macro would then need to be enabled for overlay (&f4X) and will then appear on top of each printed page. It's important to avoid any printer reset or macro commands between the definition and overlay of the macro and the actual print data. Alternatively, we can create a macro for you given the logos or other text, etc.. you wish to see on the page.+
Hi, Is it possible to print a string between 2 fixed positions on the paper. I mean even if string is long, cutoff the rest after the end position. If i use Esc*p500x500Y, it will print full string.
James Newton of Massmind replies: I think the only way to cut off the end of the string is to "erase" it with an opaque white rectangle after you have already written it out. That's NOT a clean solution, I know... You might try playing with the left and right printable margins...+
I have been told that I can take a TIFF image file and prefix it with a PCL command to use in an IBM z/Os PCL2AFP conversion tool. What is that command and what exactly do I do with it? We are hoping to be able to use this in batch processing.
James Newton replies: I do not believe that is correct. There are simularities between the encoding of certain types of TIFF images and the PCL image encoding, but the headers are different so they would have to be stripped from the TIFF before the PCL header is added. Instead, I would look for existing programs that convert images to PCL. ImageMagick is one possibility.+
I am using an old dbase5 for dos program and would like to get compressed print from an HP 1320 laserjet.
What PCL sequence should I use for compressed print and then to go back to normal print ?
James Newton replies: See The PCL Typeface List and the entries for Universe Condensed.+
For a report made by a system that can only output text files, I want to create squares around some text areas using PCL. However when I try to change the horizontal cursor position, nothing happens. A square would only show top, bottom and left lines. I tried this using&a#H, *p#X and &a#C. I use PCLreader software or direct to a HP2550Lj printer. Any suggestions on what could cause this?
*p900x600Y
*c600a6b0P
*p900x600Y
*c6a600b0P
*p900x1200Y
*c606a6b0P
*p1500x600Y
*c6a600b0P
James Newton replies: Ah, yes, common error. The issue is the carriage returns and line feeds between the codes. Each CR/LF returns the cursor to the left edge of the page. Putting all the codes on one line fixes the problem.+
How do I type the same character (or pattern) twice without moving the cursor on or stepping the paper on? We are trying to use PCL in a final year project at university to print a mask for an integrated circuit application where exact registration between the printed layers will be critical... We are not very familar with PCL and HP don't seem to want to help. Many thanks
James Newton replies: I'm not sure I understand what you mean by "moving the cursor on" but I assume you want the cursor to stay in or return to the place it was before you typed the character. I also don't understand how that applies to registration between layers. However...
Hi,
I am wondering whether PCL5 or PCL6 supports CMYK? I understand that PCL supports CMY color space, which means each pixel could have three components, i.e. C, M and Y. Printer might generate a K component by itself. However, if I want to generate the K component and pass to the printer, how to do it? In the other words, how to make the printer take all 4 components (CMYK) for every single pixel of the image?
I am trying to print barcode (interleaved 2 of 5) along with data. I am formatting the data in PCL and submitting it to CUPS, which ultimately routes it to Lexmark T632 printer. I am able to print the text data, but cannot create barcode with interleaved 2 of 5.
I am not sure I am asking the right question?
Any input or guidance will help.
Thanks,
James Newton replies: PCL doesn't have any inherent ability to print barcodes. If the printer has a font, you need to find the PCL code to select it (print a typeface list from the printer front panel) and then send that before the data. 2 of 5 also has an encoding that you must deal with. It should be documented with the font or with the font documentation for the printer. There are also some printers (I seem to remember Brother printers) or additions for printers (Barcode JetCaps DIMMs for HP, IIRC) that do all the work for you: Just send the selection code and the data and the encoding is managed automagically. Another way to do it is to write application code that translates the data into PCL area fill commands to draw the barcode directly.+
Dear Sirs
I always have used PCL5 but now I need PCL6 for an older DOS program (foxbase). The printer is an HP LaserJet 2840 AIO and does not support PCL5. Just a few commands wil do: changing to ARIAL and back to COURIER and changing the pitch or height of the letter.
Many thanks
James Newton replies: Unlike PCL5 which is basically ASCII printable text with commands added via the escape, PCL6 is ALL commands. E.g. There is a command to print text. I am not aware of any method of supporting PCL6 from a DOS app, but I would love to be proven wrong.+
I am trying to get a Brother Laser to print from DOS type commands and it seems to accept the PCL5 commands but never prints the data. What does it take to get the data to actually print. All of the examples show ...data here... and I assume its just normal ascii data. Can someone please tell me if this is true.
James Newton replies: It isn't clear from your question if a page actually comes out of the printer. If not, you need to send a page eject command. If so, then the only things I can suggest are that the text has been positioned off the printable area, an opaque white area fill has covered over the text, that the size has been set very small (e.g. 1 point) or that the pattern transparency or color have been set such that the text is not visable. Also, make sure you are using a printer that actually supports PCL directly. Many low end units are "WinPrinters" which depend on the host to render the PCL into a bitmap which is all the printer understands how to print.+
What does the flag '9' mean in PE command? The 'Introduction to HP-GL/2 Vector Graphics' says that the flag in PE command can be '>' '<' ':' '=' '7'. So I've found a prn file which contains 'PE9=' command. How could it be explained?
Hello, i have a problem with PCL. I try to set the cursor to a horizontal position to align amounts along the decimal comma (invoices). But i dont find any about this problem in the HP-Documentations or Internet. Ist there a way to align amounts correctly? Is it possible to set the horizontal position not only left?
James Newton replies: See Right justification of text+
http://www.hitachi-printingsolutions.us/techsup/manuals/DDP92/PCL.pdf UPDATE FOR YOUR SITE:
FOUND AT:
http://www.hitachi-printingsolutions.us/techsup/manuals/DDP92/PCL.pdf
UPDATE:
Pixel Placement
ESC l [#] R This command determines how pixels are rendered in images.
Two models are used for rendering pixels when an image is placed on paper:
0 Grid Intersection Model
1 Grid Centered Model
This command can be invoked multiple times during a page. It has no effect except to switch the model being used for imaging.
James Newton replies: Thank you for noting that. I believe that is actually a typographical error in the hitachi documentation. The HP docs list that as ESC * l # R which is more believable and seem to work on my printers. In either case, this command was missing from my list, so I appreciate your adding it.+
Hi, thank you for the answer and forgive me but I'm again here with a question. I can't get a circle by the command CL in HP-GL/2 mode (nothing happens, nothing is printed). The listing INSP1PA2400,2500EW500,0,360; works but the listing INSP1PA2400,2500CL500; doesn't. I'm doing timing tests, so using one command instead of another can make a difference. Could you please help me one more time. Thank you. Dina Sukhanova
I have written my own file on PCL-language. It works: prints 800 lines and cirles in Hp-GL/2 mode, but only on one page. How can I add transferring to a new page. Actually it should be 10 pages. My task is to test different printers. Thank you in advance. Good luck in your job. Dina Sukhanova
James Newton replies: Just exit HP-GL mode, add a formfeed character (ASCII 12) or any PCL page setup command.+
I need ability to use PCL for NUMBER OF COPIES in an MS-WORD document. Any help would be appreciated. I can't find anything from MS-WORD (other than the option when printing).
James Newton replies: Any PCL command for number of copies that you place inside the document will probably be over-ridden by Word when it prints, but the command is esc&l#X.+
I am trying to ptint labels on a paper source that is 12 inches long. I can use most of the paper but at the bottem of the page it stik the last two inches. This then move that part of the page to the next page. Is thier a command that will allow me to set the page length to 12 inches or a set of command that will do this.
James Newton replies: You should be able to send the esc&l3A command to set the page size to legal (14") then avoid printing past 12".+
I have this bat file I created using the code under Drawing Rectangles (PCL),when I run it I get this message '<-' is not recognized as an internal or external command operable program or batch file. Not sure what I am doing wrong, I have tried it with and w/o the *, putting a space before the * and after *, I even placed '>prn at the end of every line. I have window 2000 as my OS can this be the problem. (I also tried it not using the dos editor and got the same results.
James Newton replies: Try this in your .BAT file:
echo hello > prn
then if that prints something to the printer, use the instructions at Using DOS EDIT on an IBM PC to set up test files to enter the PCL commands from the Drawing Rectangles page in place of the word "hello". Remember, the Ec character is not really and "E" and a "c". In DOS EDIT, it will appear as a left pointing arrow.+
Hello I have a PCL problem . I have a PCL file and I want to extract the text from it . Like : at position 10,10 I have : "This is the beginning" ..... 10,100 : "This is the end" Is this possible ? I am totally beginner in PCL , and as I saw the file doesn't contain the characters I want to print instead some graphical stuff.
James Newton replies: Based on your description (especially the part about the text not being present in the file) I would guess that the fonts are being downloaded and that different symboles (other than the original letters in the text) are being used for each letter.
This is very (VERY) difficult to extract text from. You might try http://www.pcltools.com +
I am trying to create invoices for 4si and 8000n printers. I am getting the invoice form/macro loaded and called correctly with data, but would like more. It seems I cannot select to load the form first and then the data, it always does it data then form. Can this be corrected? I would also like a watermark to print on top/below the form and data. Is the a way to get this done?
James Newton replies: Answer: See the macro commands listed above: +
Comments:
Hi there, I am tring to print some boxes on my page and the printer (laserJet 5000N) does not seem to recognise the box commands: 048=p900x2100Y 049= c100a100b0P I convert the to char 27, the printer just prints "900x2100Y" and "100a100b0P". I have tried the GL/2 commands and they work although with the absolute positioning starts from bottom left hand corner. Thanks for your informative site.
James Newton of Massmind replies: the correct commands are *p and *c. You are missing the "*".+
I working on printer driver. I am trying to print bitmap on HP 930c PRINTER. I would like to get esc sequence to print the same.
[ I tried Esc * b # V sequence, but not working] .Please help
James Newton of James Newton's Massmind replies: Try sending the following: esc*t300R followed by esc*b8WU3//@~@~ about 30 times. You should see a nice black and white pattern that looks something like:
W W W W WW WW W WWW W WWW W WWWWWWW W WWWWWWW
Basically this is a pattern of fine vertical lines that get thicker to the right. For more see the page on printing pictures in PCL.+
Please note on HP-GL/2:+
%0A - enter PCL mode (from HP-GL/2)...
0 = Use "RTL" CAP and RTL palette
1 = Use HP-GL/2 pen position & RTL palette
2 = User "RTL" CAP and RTL palette
3 = Use HP-GL/2 pen position & HP-GL/2 palette
What is RTL? Is this PCL?
Blake Turner, infotech@precisioncompanies.com
RTL is the Raster Transfer
Language, a subset of PCL. Used to print bitmaps on printers that don't naturally
use them (namely plotters which use pens and draw lines).
+
file: /Techref/language/pcl/index.htm, 56KB, , updated: 2020/8/17 10:41, local time: 2024/12/24 08:31,
18.219.81.129:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/language/pcl/index.htm"> PCL5 Printer Language Reference, PCL printer, printer</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.