Operating System - OpenVMS
1748129 Members
3629 Online
108758 Solutions
New Discussion

Re: Need help using PCL to print barcode

 
Angi Brown
New Member

Need help using PCL to print barcode

I am writing a report that is called from a web page to print out 3 of 9 barcodes. I am having trouble getting the barcodes to print correctly. I have tried finding some documentation on using PCL, but have not found much for barcodes. I found some bits and pieces of code to use. The printer I am testing on is a Lexmark x544 and it says it has C39 Narrow, C39 Regular, and C39 Wide fonts on the printer.
These are the different pcl codes I have tried, but they don't print out a full barcode:

CHAR(27) + '(0Y' + CHAR(27) + '(s1p12v0s0b32772T*ABCDE123*' + '(3@'

CHAR(27) + '(0Y' + CHAR(27) + '(s0p8.1h12v0s0boT' + CHAR(27) + '*25531X*' + '(3@'

CHAR(27) + '(0Y' + CHAR(27) + '(s0p8.1h12v0s0boT*12345*'+ '(3@'

CHAR(27) + '(0Y' + CHAR(27) + '(s0p4.69h12.0v0b0T*12345*' + CHAR(27) + '(3@'

The 32772T is the one from the font listing off the printer.

I have also found this code that almost works.
Except, it does not print out the numbers 7,8,9 or the uppercase letters H-Z. But, it does print lowercase letters.

CHAR(27) + '(25531X*' + @v_vchEquipmentId + '*' + CHAR(27) + '(3@'

Could someone please help me figure out why it is not working, or point me in the right direction for some help?
8 REPLIES 8
Robert Gezelter
Honored Contributor

Re: Need help using PCL to print barcode

Angi,

Welcome to the HP ITRC OpenVMS forum.

Having done this type of thing in the past, I would have to sit down with the manual, and with precise samples of the output.

I also recommend starting with a far simpler problem, namely using a tool such as Kermit to write directly to the printer. Also, since presumably the printer is connected to a serial port, a full listing (SHOW TERMINAL/FULL) of the relevant device would be helpful.

These problems can be subtle, but in the end they are always explicable.

- Bob Gezelter,
Brad McCusker
Respected Contributor

Re: Need help using PCL to print barcode

Why PCL? Can you use postscript?

The gnu barcode program will create postscript barcodes and it builds easily on VMS (using gnv -its pretty simple you could probably easily build it without GNV too).

http://www.gnu.org/software/barcode

Brad McCusker
Software Concepts International
www.sciinc.com
Brad McCusker
Software Concepts International
Doug Phillips
Trusted Contributor

Re: Need help using PCL to print barcode

You need a programming manual for your printer, or at least know the PCL compatibility level and find that PCL programming guide. The fact that you're at least getting something to print is good.

I've never set up this specific printer, but have dealt with many other brands/models, so this is general PCL information.

You seem to be confusing the FONT, SYMBOL SET and TYPEFACE commands, and there are some typos in the examples.

(assuming the leading Escape and single commands)

Use Fixed Spacing: (s0P

In all but the very last command, you are sending Symbol Set ID= 0Y as (0Y and this is fairly common, but you'd need to know what's in your printer.

In the first command you list, you're using Proportional spacing (s1P and sending the Font ID in the Typeface command (b#T where # should be the Typeface rather than Font, if that's what you want to do. The Font command is (#X where # is the Font ID.

In the second and third, you send a lower case o in the Typeface command as (boT and it should probably be a zero (b0T and I don't know what *25531X is supposed to do. If you are selecting Font 25531 it should be (25531X

The fourth example is very close to what I use for an HP PCL printer. It uses the common Bar Code Typeface and Symbol set so maybe the wrong font is active.

Without having your printer to play with, that's about all I can give you.
Hoff
Honored Contributor

Re: Need help using PCL to print barcode

It can be cheaper to use an existing library and tools, even if you have to port it over to VMS.

Haven't looked at what's in this old Freeware submission in detail in a while, but it looks to do 39 for you:

http://decuslib.com/freeware/freewarev60/barcode/

Other options and languages:

Lua:

[expired broken link removed on <4/4/2017> by Mod] 


Python:

http://freshmeat.net/projects/barcodes-for-python
http://pypi.python.org/pypi/elaphe/
https://pypi.python.org/pypi?%3Aaction=search&term=pyBarcode&submit=search


php:

http://www.sid6581.net/cs/php-scripts/barcode/
http://pear.php.net/package/Image_Barcode/

Here's a php pdf generator that can do barcode

http://www.fpdf.org/

There's a cute php demo for a UPC barcode here:

http://php.net/manual/en/ref.image.php

Perl:

http://cpansearch.perl.org/src/KWITKNR/GD-Barcode-1.15/Barcode/

All of the above languages are available on VMS.

Or toss the data over to a Windows or Mac or Linux box, and print the document and the barcode from there.

I'd expect commercial solutions for generating barcodes exist for OpenVMS, as well. Check the HP AllianceONE (formerly DSPP) product listings.

www.hp.com/go/dspp

Brad McCusker
Respected Contributor

Re: Need help using PCL to print barcode

The barcode tool Hoff pointed you to on Freeware V6 is the same one from GNU that I pointed you to, except I think the freeware version has a DCL compatible build script.

That one works pretty well. If you can print Postscript, I encourage you to take a look at using it. Seems like a very easy way forward.
Brad McCusker
Software Concepts International
Bob Blunt
Respected Contributor

Re: Need help using PCL to print barcode

Angi, you don't really say if you're trying to print from a system running OpenVMS. And you haven't said what type printer.

With Google I found the following URL:

http://www.computing.net/answers/openvms/pcl-specific-print-tray-commands-and-vms/583.html

and the person responding seems to be doing what you're after, at least printing using PCL to a printer on OpenVMS.

The "traditional" way to handle printers is to use a queue and symbiont to send the data to the printer which might be either connected to a serial device (of several different types), a parallel interface or USB (if your unknown system HAS USB for that matter). The code you've posted looks like it's "plain ascii" PCL commands and that might work best if you copied it using the COPY command to the printer or possibly programmaticly by opening the serial port and writing directly to the printer. There are many alternate solutions so it makes sense (to me) to try and find someone else who has done something similar and pick their brain. There are also software vendors who have solved this and other printing "problems" on OpenVMS for non-native printers. One of these, I think, is Northlake.

There's also this ITRC thread:

http://h30499.www3.hp.com/t5/General/OPENVMS-PCL-PRINTING-TO-HPLASERJET-4200/m-p/3311280#M2827

Bob Blunt
Respected Contributor

Re: Need help using PCL to print barcode

There are also other threads in ITRC that seem pertinent, one of them:

http://h30499.www3.hp.com/t5/System-Management/HP-LJ4200TN-PCL-for-barcode-on-off/m-p/3818587#M12729

gdjump
Occasional Visitor

Re: Need help using PCL to print barcode

thank you.  i am sort of looking for such device to print differnet tyoes of barcode I will give it a try.  can i have a try version.