See the <esc>*b commands
Richard H. Mock [RHMock at bellsouth.net] says:
Using a search engine I happened upon [this web site]
I chose to ask an expert, Mr. James Newton, how to embed pictures in PCL text. Having realized no responses to my queries of other experts, I did not expect a reply from Mr. Newton. He surprised me with an answer within an hour.
FYI: I use under WINDOWS 98 DOS a UNIX lookalike editor, "gvim" (Greatly Visual editor IMproved). Don't snicker at the acronym, the UNIX full screen editor is known as "vi", short for visual. The German gentleman who wrote the early DOS versions, named his product "vim", Visual IMproved, and renamed the later versions "gvim". When I was in harness (gainfully employed), my last several years as a programmer- analyst using big iron were spent in an UNIX environment. To me, the DOS editor, as DOS when compared to UNIX, does not measure-up; hence, I searched the Internet for a better text editor and found vim. All of this is to indicate that I bypassed any possible corruption of data problem using DOS.
All of the picture files to which I have access are of the file extensions ".bmp" and ".jpeg", so once more I employed the search engines and located a file conversion facility at:
I used this facility to convert a small .bmp file to a .pcl file. By the way, I added this URL to my "Favorites".
I opened a new file and entered some basic PCL commands and a single line of text before keying the command to enter the GL/2 mode (Esc%1B). Then, I copied, using the gvim read a file command, the .pcl file into the object file. Lastly, I keyed the command to re-enter PCL (Esc%0A) and entered a few words of text before saving the file.
From DOS, I entered the command "TYPE file-name.txt > prn", the DOS command "PRINT" has been inactivated in Windows. The H-P LaserJet 5 printer responded with three sheets, each part (PCL, GL/2, /PCL) on a separate sheet. Success! All that remains, and that is much, for me to do is learn to use the "picture frame" commands.
In a few words Mr. Newton saved me many hours of further research, something that several other people were afforded an opportunity to do, and did not do.
Thank you, Mr. Newton.
I converted a letterhead logo to .pcl -- on a pcl reader, it looks great. However when the logo is printed as an overlay on letters, it is very distorted - too large, spacing between lines off, symbols crooked.James Newton of Massmind replies: All the commands in a PCL Macro have to match the print job in terms of resolution, dimensions, etc... or you must specify before the commands in the macro what those parameters are, and use the 3x or 4x overlay command so the parameters of the original print job are restored for the next page of print data. If the resolution of the converted logo isn't being specified, that would cause this sort of distortion. Another possibility is that the converted pcl commands were edited or processed in some way by a program that removed the high bit from any binary bytes or dropped nulls (binary zeros) from the image data. This is more likely in cases were the distortion includes random horizontal offset and "fuzz" or missing lines.+
Is there a way to correct this? Thank you!
Please forgive silly questions - but pcl is all new to me. I am simply trying to put a graphic (BMP) on the head and another on the foot of letters in a dos program that allows for esc sequences to printer.James Newton of Massmind replies: The macro can be stored as a file, but with a graphic image in it, it will NOT be a text file, it will be binary. The data (from the file or otherwise) must be injected into the print job, after any reset or page setup commands, and before any actual data is printed. The graphic print commands are used to represent data, and can be placed inside the macro definition, but they are not in the BMP format, the BMP file must be converted to PCL commands. The macro overlay would typically include ALL the graphics to be overlayed on the page. Once the macro is defined, it is overlayed on each page with the macro overlay command. An example could be developed as time allows.+
To make a "Macro" - is this a simple, separate TEXT FILE of commands? If so, how is it named so that it can be referenced by the pcl execute command? What command is used to reference the bmp file to load it into the macro -- or should I convert the bmp to something else for easier usage? Should I just pull in the graphic on top and bottom, or use an overlay with both header and footer that allows the letter text in between the 2 graphics? If so, how to overlay?
Perhaps an example of a COMPLETE macro that loads a graphic with ALL its steps would clarify. THANK YOU!
I am completely new to PCL5 programming. But I am trying my hardest. I need to upload and store 4 or 5 circular label images (may be .bmp files) on a VIP8020 laser printer and print the labels in a matrix of 3 X 5, dynamically deciding what image file would be printed at what matrix index.James Newton replies: That is done differently for each different type of printer. Some software or documentation SHOULD be available from the printer mfgr. Having said that, good luck finding it. Shilpa R. Gupte of Geometric Controls Inc. replies: Thanks for the kind reply. I have started talking with the printer tech support guys. I hope I succeed in achieving my goal. Thanks for taking time to take a look at this. I really appreciate it.+
First question is when I upload the images on the printer hard drive how do I know what macro the printer has assigned to each image to print? So I can call this macro from my code. Please help me. I really need to do this.
Hello Sir,James Newton replies: My best guess is that you are using a non-binary editor to create or change your overlay. The smeared lines are symptoms of binary data corruption. See the binary editor page for suggestions.+
I am trying to create a full page overlay of a form to be used to print a packing list. I finally got the overlay to print but where there is text in the overlay it looks like the lines smear to the right. I am also getting garbage characters on the left side of the page. Any help would be greatly appreciated.
Hi I am trying to print a bitmap through to a HP Laserjet PCL printer. I am able to read the bitmap into a byte array but am unable to print this byte array as raster data to the printer. I have tried different options to print to the printer but it either prints the decimal values of the byte array or prints a box with overwritten characters.
This bitmap is a 32x32 of 2102bytes. I have been able to separate the header information from the raster data - 54Bytes (Header)+(4*256)(No. of Colors)+1024Bytes(raster data)=2102Bytes.
While sending this data to the PCL printer do I have to do some special processing to the header/main raster data before I send it to the printer.
I am trying to use the <Esc>*b#W escape sequence to send the raster data. I think I need to use the <Esc>*b2M sequence but am not sure of the exact command structure.
Any suggestions would be graetly appreciated.
James Newton replies:
I think the biggest part of your problem is that the image is in color rather than black and white. The *b commands only process black and white data. Try sending esc*t300R followed by esc*b8WU3//@~@~ about 30 times. You should see a nice 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. If you see anything else, some other problem exists with your communication to the printer. I picked the values so that none would need to be unprintable binary but the data following the W (the U3//@~@~) is binary image data. Each bit of each byte represents one single dot at 300 dpi. So the first (left most) part of the pattern: W W W W is 01010101 or 0101 0101 or hex 55 or ASCII U. The 3 following the U is hex 33 or 00110011. See? No color. Just black and white. So if you get an array of binary image data with 1 bit per pixel, you just need to count the number of Bytes (not bits) on each line (this is the 8 before the W in my example) and send esc * b (the count) W (the raw data). If the bits don't come out to an even number of bytes, just pad the right side with zeros. E.g. if you have an image 7 pixels wide, just add an extra 0 to make a full byte.
Now, after that is working, you can play with *b2M for TIFF format. This is just a compression system where the data starts with a control byte which can be positive (0-127) or two complement negative. Positive values indicate a number of data bytes to follow that are simply standard binary data just like above. Negative values indicate that the next byte should be repeated that number of times. This is most effective at compressing images with large areas of black, white, or patterns that repeat every 8 pixels. Hint: How are gray patterns done on a black and white only printer?
Hope that helps. Please consider sharing the code you write.
I have a .BMP that we have converted to a PCL that we want to use as a logo on our reports. I as able to assign it to a macro and execute it, but I cannot control the horizontal placement (<esc>*p#X). I can control the vertical placement (<esc>*p#Y). Is there something that can help me with its placement. There is no reference anywhere in the macro itself as to placement.
James Newton replies:
I'll bet there are carrage return / line feeds... <GRIN>
The above link http://daytona.ca.sandia.gov/cgi-bin/conversion_central-3.2/cccgi is not working. Do you have another link where I can convert my .JPG file to .PCL file ? Thanks, Nikhil Shah
James Newton replies:
Not online, but... http://www.imagemagick.org Batch file image editor that can convert just about anything to just about anything else while scaleing, rotating, adjusting, etc... Open source. Excellent.
Hello, We've got HP Laserjet 8150 series printers. We have uploaded the .BMP files which contains our Invoice Logos onto Printer's Hard Disk using HP Resource Manager. While uploading it, printer has assigned macros for each logo to print. We are calling specific macros to print each logo. Ofcourse it prints the logo but it comes out in big size where if we print the same .BMP file from PhotoShop it prints fine & exact size we want. How do I control the width & height of .BMP file stored in Printer ? I already used Ec*c999x999Y & many Ec* commands but nothing controls it. Your help will be appreciated. Thanks. Nikhil Shah
Answer: You can't. The only way to re-size a logo is to re-create the logo at the new size.
|file: /Techref/language/pcl/pictures.htm, 16KB, , updated: 2017/2/23 12:59, local time: 2022/8/8 19:34,
|©2022 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://techref.massmind.org/techref/language/pcl/pictures.htm"> PCL5, Computer Graphics, Pictures</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to techref.massmind.org!