I am looking for a simple(?) way to convert a part number and print
the number along with the upc barcode for that number on a plain paper
report. I have laser and inkjet printers available. The discussion
pages go back a few years and I was wondering if there are any more
current solutions available.
As always, any help will be appreciated.
Marc Zitcer
I have used a routine for the past years that creates a "3 of 9"
barcode. Not a true UPC format, but read by almost any barcode reader
out there.
Beyond that, It can also be used for barcoding invoice numbers,
customer numbers, etc,
The way I use it is to create the barcode and then swap out the code
for a tagged field in a print template.
I have listed it below.
HTH,
Robert
SUBROUTINE BARCODE.PCL.SUB
(BARCODE.INPUT,BARCODE.OUTPUT,BARCODE.HEIGHT)
* @(#) BARCODE.PCL.SUB Ported to jBASE 11:52:13 01 MAY 2007
IF BARCODE.HEIGHT = "" THEN BARCODE.HEIGHT = "90"
BARCODE.OUTPUT = ""
BARCODE.OUTPUT = BARCODE.OUTPUT: CHAR(27):"*p-":BARCODE.HEIGHT:"Y"
*** add *'s for Code 3 of 9 delimiters ***
WORK.BARCODE.INPUT = "*":OCONV(BARCODE.INPUT,'MCU'):"*"
XX = LEN(WORK.BARCODE.INPUT)
FOR K = 1 TO XX
THECHAR = WORK.BARCODE.INPUT[K,1]
GOSUB MAKE.CHAR
FOR P = 1 TO 9
X = MOD(P,2)
NW = PATTERN[P,1]
IF NW = "." THEN W = "3" ELSE W = "9"
IF X # 0 THEN
BARCODE.OUTPUT = BARCODE.OUTPUT:CHAR
(27):"*c":W:"a":BARCODE.HEIGHT:"b0P"
BARCODE.OUTPUT = BARCODE.OUTPUT:CHAR(27):"*p+":W:"X"
END ELSE
BARCODE.OUTPUT = BARCODE.OUTPUT:CHAR(27):"*p+":W:"X"
END
NEXT P
BARCODE.OUTPUT = BARCODE.OUTPUT:CHAR(27):"*p+10X"
NEXT K
RETURN
MAKE.CHAR:
BEGIN CASE
CASE THECHAR = '1' ; PATTERN ="-..-....-"
CASE THECHAR = '2' ; PATTERN ="..--....-"
CASE THECHAR = '3' ; PATTERN ="-.--....."
CASE THECHAR = '4' ; PATTERN ="...--...-"
CASE THECHAR = '5' ; PATTERN ="-..--...."
CASE THECHAR = '6' ; PATTERN ="..---...."
CASE THECHAR = '7' ; PATTERN ="...-..-.-"
CASE THECHAR = '8' ; PATTERN ="-..-..-.."
CASE THECHAR = '9' ; PATTERN ="..--..-.."
CASE THECHAR = '0' ; PATTERN ="...--.-.."
CASE THECHAR = 'A' ; PATTERN ="-....-..-"
CASE THECHAR = 'B' ; PATTERN ="..-..-..-"
CASE THECHAR = 'C' ; PATTERN ="-.-..-..."
CASE THECHAR = 'D' ; PATTERN ="....--..-"
CASE THECHAR = 'E' ; PATTERN ="-...--..."
CASE THECHAR = 'F' ; PATTERN ="..-.--..."
CASE THECHAR = 'G' ; PATTERN =".....--.-"
CASE THECHAR = 'H' ; PATTERN ="-....--.."
CASE THECHAR = 'I' ; PATTERN ="..-..--.."
CASE THECHAR = 'J' ; PATTERN ="....---.."
CASE THECHAR = 'K' ; PATTERN ="-......--"
CASE THECHAR = 'L' ; PATTERN ="..-....--"
CASE THECHAR = 'M' ; PATTERN ="-.-....-."
CASE THECHAR = 'N' ; PATTERN ="....-..--"
CASE THECHAR = 'O' ; PATTERN ="-...-..-."
CASE THECHAR = 'P' ; PATTERN ="..-.-..-."
CASE THECHAR = 'Q' ; PATTERN ="......---"
CASE THECHAR = 'R' ; PATTERN ="-.....--."
CASE THECHAR = 'S' ; PATTERN ="..-...--."
CASE THECHAR = 'T' ; PATTERN ="....-.--."
CASE THECHAR = 'U' ; PATTERN ="--......-"
CASE THECHAR = 'V' ; PATTERN =".--.....-"
CASE THECHAR = 'W' ; PATTERN ="---......"
CASE THECHAR = 'X' ; PATTERN =".-..-...-"
CASE THECHAR = 'Y' ; PATTERN ="--..-...."
CASE THECHAR = 'Z' ; PATTERN =".--.-...."
CASE THECHAR = '-' ; PATTERN =".-....-.-"
CASE THECHAR = '.' ; PATTERN ="--....-.."
CASE THECHAR = ' ' ; PATTERN =".--...-.."
CASE THECHAR = '*' ; PATTERN =".-..-.-.."
CASE THECHAR = '$' ; PATTERN =".-.-.-..."
CASE THECHAR = '/' ; PATTERN =".-.-...-."
CASE THECHAR = '+' ; PATTERN =".-...-.-."
CASE THECHAR = '%' ; PATTERN ="...-.-.-."
END CASE
RETURN
END
The solution really should be independent of the printer.
Have a look at our web page for PrintWizard:
remove.nospam.pleaseNebula-RnD.com/products/printwizard.htm
(We don't sell it or get commissions, I just like and recommend
it.)
Note what Robert provided for "3 of 9" formatting only:
BARCODE.OUTPUT =
BARCODE.OUTPUT:CHAR(27):
"*c":W:"a":BARCODE.HEIGHT:"b0P"
BARCODE.OUTPUT =
BARCODE.OUTPUT:CHAR(27):"*p+":W:"X"
....
CASE THECHAR = '1' ; PATTERN ="-..-....-"
CASE THECHAR = '2' ; PATTERN ="..--....-"
While it's great that it works, it's not "simple" by any means,
only does one format, and must have taken a lot of time to code.
Now compare that to PrintWizard code (see Demo2 from link above):
BNUMBER = "1234567890"
PRINT "<goto x=.1in y=1.15in>"
PRINT "<p align=center><font size=20pt>":
PRINT "Barcode for ": BNUMBER :" is":
* Move to 300 pixels after the word 'is'
PRINT "<goto x=+300>":
* Add the barcode itself
PRINT \<barcode pointsize=20 src="\ : BNUMBER :
PRINT \" style=2of5 addcheckchar=off>\
PRINT "</font></p>"
The XML gets interpreted by PrintWizard after the print job is
spooled and before it hits the printer - you actually spool into
PW and that spools back out to the desired printer. Note:
- the specific positioning,
- lack of cryptic PCL escape codes,
- ability to change the style/coding just by saying "2of5",
"3of9", etc,
- it's completely printer independent,
- it's independent of MV platform,
- (actually independent of MV entirely so you can use it with
other non-jBase projects)
- and it's very simple to read and write, which matches the
original request.
HTH
Tony Gravagno
Nebula Research and Development
TG@ remove.pleaseNebula-RnD.com
Nebula R&D sells mv.NET and other Pick/MultiValue products
worldwide, and provides related development services
remove.pleaseNebula-RnD.com/blog
Visit PickWiki.com! Contribute!
http://Twitter.com/TonyGravagno