For Programmers: Free Programming Magazines  


Home > Archive > Clipper > January 2006 > Bar Codes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bar Codes
mark@darbymetalinc.com

2006-01-10, 3:55 am

Thanks everyone for all your help. I have one more question for you.

I have a program that printed bar codes on some reports. It used
escape40 with the command hp39(). Well escape40 does not work under my
XP so i switched back to escape30, but it does not support bar codes. I
also have tried to use dBest bar code tool but it does not want to
print to a laser printer in a windows enviroment.

Does anyone recommend or know of another bar code tool that will work
in XP, Clipper 5.2 and on a laser printer?

E. Fridman

2006-01-10, 3:55 am

<<< Well escape40 does not work under my XP ... >>>

What exactly seems to be a problem? I believe that my application
using Escape! 4 (real mode) worked fine under XP.

mark@darbymetalinc.com

2006-01-10, 3:55 am

Escape40 will make the software very unstable. It will lock up at
different times. This is even before trying to print. When I try to
print i get 65533 error. After switching back to 30 my software is very
stable and works flawlessly, except for this bare code problem.

Robert J. Stuart

2006-01-10, 3:55 am

Mark, years ago I wrote some code to produce my own bar codes, numeric
only, for a project I was working on. There was no bar code plug ins at the
time so I figured out the exact spacing of the vertical bars and spaces and
wrote a series of calls to produce this for both a HP laser jet using PCL5e
or PCL6 drivers. This is all for dos applications and worked pretty well
for me for years. The code is a little bulky, I wrote it for S87 and years
before I learned to trim my code down. But I would be happy to share it
with you and maybe you can clean it up and use it.
Contact me at rjstuart@earthlink.net if you want it.

Bob S.


<mark@darbymetalinc.com> wrote in message
news:1135974803.600859.257270@o13g2000cwo.googlegroups.com...
> Escape40 will make the software very unstable. It will lock up at
> different times. This is even before trying to print. When I try to
> print i get 65533 error. After switching back to 30 my software is very
> stable and works flawlessly, except for this bare code problem.
>



mark@darbymetalinc.com

2006-01-10, 3:55 am

I was looking at the versions on my software and I noticed that our
dBest is ver 2.1. Does anyone know if there is a newer version or if it
is or is not compatible with windows XP?

E. Fridman

2006-01-10, 3:55 am

What is the date/time stamp of your Escape 4 LIB file?

The latest one I used was dated 09/02/04 (US).

Dave P

2006-01-10, 3:55 am

below is code too barcode for hp pcl or Epson (dot matrix)
you can make your adjustments too meet our needs

dave
/*
Clipper Version 52e
*/
#INCLUDE "INKEY.CH"
#xcommand ?13 [ <list,...> ] => QQOut( <list> );qqout(chr(13)+chr(10) )

/* Parameters
1:=Character String to Barcode (c)
2:=Message to Barcode (if None The None will print) (c)
3:=Type of Printer D=Dot Matrix Epson or Ibm, L=Hp or Compatible (c)
4:=Height of Barcode 1-8 (n)
5:=Line Spaces Between Bars and cDescription 1=1 1/6 Space (n)
6:=Column To Print The Barcode
*/
/*
FUNCTION test

printeron()
DVBAR("S2048",space(30)+"S2048","L",2,2,30)
RETURN(NIL)
*/
// ****************************************
********************************
function DVBAR(cToBar,cDescr,cPrinter,nHeight,nli
nespace,nColBegin)
// ****************************************
*********************************
local nb,wb,ns,ws,n1,n2,start,end,chars,char[4
4],ESC,CODE,NULL,;
letter,x,i,h,small_bar,wide_bar,dpl,cols
,nLinecnt,cReset

cToBar:=("*"+Upper(trim(cToBar))+"*")
Esc:=CHR(K_ESC)
nLineSpace:=if(nLinespace==NIL,2,nLinesp
ace)
nLinecnt:=(nLineSpace*10) // Spaces between bars // Dot Matrix
code := ""
Null:=""
nHeight:=IF(nHeight==NIL,3,nHeight)
nColBegin:=IF(nColBegin==NIL,0,nColBegin
)
if cPrinter=="L"
*** define bars and spaces for HP LaserJet
nHeight-=.25
small_bar := 3 && number of points per
bar
wide_bar := round(small_bar * 2.25,0) && 2.25 x small_bar
dpl := 50 && dots per line
300dpi/6lpi = 50dpl

nb :=
esc+"*c"+transform(small_bar,'99')+"a"+alltrim(str(nHeight*dpl))+"b0P"+esc+"
*p+"+transform(small_bar,'99')+"X"
wb :=
esc+"*c"+transform(wide_bar,'99')+"a"+alltrim(str(nHeight*dpl))+"b0P"+esc+"*
p+"+transform(wide_bar,'99')+"X"
ns := esc+"*p+"+transform(small_bar,'99')+"X"
ws := esc+"*p+"+transform(wide_bar,'99')+"X"

*** adjust cusor position to start at top of line and return to bottom of
line
start := esc+"*p-50Y"
end := esc+"*p+50Y"

elseif cPrinter=="D"
***** define Epson bars and spaces
ns := chr(0) + chr(0)
ws := chr(0) + chr(0) + chr(0) + chr(0)
nb := chr(255)
wb := chr(255) + chr(255) + chr(255)

***** set cPrinter to 2/216 lines per inch
//printcode(esc+chr(51)+chr(2))
qqout(esc+chr(51)+chr(2))

***** calculate N1 and N2 values for dot graphics command
cols := 21
N1 := cols % 256 && modulus
N2 := INT(cols/256)
endif

chars := "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"

CHAR[01] := WB+NS+NB+WS+NB+NS+NB+NS+WB && "1"
CHAR[02] := NB+NS+WB+WS+NB+NS+NB+NS+WB && "2"
CHAR[03] := WB+NS+WB+WS+NB+NS+NB+NS+NB && "3"
CHAR[04] := NB+NS+NB+WS+WB+NS+NB+NS+WB && "4"
CHAR[05] := WB+NS+NB+WS+WB+NS+NB+NS+NB && "5"
CHAR[06] := NB+NS+WB+WS+WB+NS+NB+NS+NB && "6"
CHAR[07] := NB+NS+NB+WS+NB+NS+WB+NS+WB && "7"
CHAR[08] := WB+NS+NB+WS+NB+NS+WB+NS+NB && "8"
CHAR[09] := NB+NS+WB+WS+NB+NS+WB+NS+NB && "9"
CHAR[10] := NB+NS+NB+WS+WB+NS+WB+NS+NB && "0"
CHAR[11] := WB+NS+NB+NS+NB+WS+NB+NS+WB && "A"
CHAR[12] := NB+NS+WB+NS+NB+WS+NB+NS+WB && "B"
CHAR[13] := WB+NS+WB+NS+NB+WS+NB+NS+NB && "C"
CHAR[14] := NB+NS+NB+NS+WB+WS+NB+NS+WB && "D"
CHAR[15] := WB+NS+NB+NS+WB+WS+NB+NS+NB && "E"
CHAR[16] := NB+NS+WB+NS+WB+WS+NB+NS+NB && "F"
CHAR[17] := NB+NS+NB+NS+NB+WS+WB+NS+WB && "G"
CHAR[18] := WB+NS+NB+NS+NB+WS+WB+NS+NB && "H"
CHAR[19] := NB+NS+WB+NS+NB+WS+WB+NS+NB && "I"
CHAR[20] := NB+NS+NB+NS+WB+WS+WB+NS+NB && "J"
CHAR[21] := WB+NS+NB+NS+NB+NS+NB+WS+WB && "K"
CHAR[22] := NB+NS+WB+NS+NB+NS+NB+WS+WB && "L"
CHAR[23] := WB+NS+WB+NS+NB+NS+NB+WS+NB && "M"
CHAR[24] := NB+NS+NB+NS+WB+NS+NB+WS+WB && "N"
CHAR[25] := WB+NS+NB+NS+WB+NS+NB+WS+NB && "O"
CHAR[26] := NB+NS+WB+NS+WB+NS+NB+WS+NB && "P"
CHAR[27] := NB+NS+NB+NS+NB+NS+WB+WS+WB && "Q"
CHAR[28] := WB+NS+NB+NS+NB+NS+WB+WS+NB && "R"
CHAR[29] := NB+NS+WB+NS+NB+NS+WB+WS+NB && "S"
CHAR[30] := NB+NS+NB+NS+WB+NS+WB+WS+NB && "T"
CHAR[31] := WB+WS+NB+NS+NB+NS+NB+NS+WB && "U"
CHAR[32] := NB+WS+WB+NS+NB+NS+NB+NS+WB && "V"
CHAR[33] := WB+WS+WB+NS+NB+NS+NB+NS+NB && "W"
CHAR[34] := NB+WS+NB+NS+WB+NS+NB+NS+WB && "X"
CHAR[35] := WB+WS+NB+NS+WB+NS+NB+NS+NB && "Y"
CHAR[36] := NB+WS+WB+NS+WB+NS+NB+NS+NB && "Z"
CHAR[37] := NB+WS+NB+NS+NB+NS+WB+NS+WB && "-"
CHAR[38] := WB+WS+NB+NS+NB+NS+WB+NS+NB && "."
CHAR[39] := NB+WS+WB+NS+NB+NS+WB+NS+NB && " "
CHAR[40] := NB+WS+NB+NS+WB+NS+WB+NS+NB && "*"
CHAR[41] := NB+WS+NB+WS+NB+WS+NB+NS+NB && "$"
CHAR[42] := NB+WS+NB+WS+NB+NS+NB+WS+NB && "/"
CHAR[43] := NB+WS+NB+NS+NB+WS+NB+WS+NB && "+"
CHAR[44] := NB+NS+NB+WS+NB+WS+NB+WS+NB && "%"

// Go Print Barcode
do case
case cPrinter == "L"


* read cToBar character at a time and build barcode
code:=Space(nColBegin)
for i := 1 to len(cToBar)
letter := substr(cToBar,i,1)
code := code +
if(at(letter,chars)==0,letter,char[at(le
tter,chars)]) + NS
next
code := start + code + end
// Vertical linespaceing
qqout(esc+"&l4D")
// print barcode
if ! empty(cDescr)
?13 " ",(cDescr)
endif
?13 (code)
for x:=1 to nlinespace
qqout(chr(13)+chr(10))
next

//qqout(esc+"&l"+ntrim(nlincntr*48)+"C" //

qqout(esc+"&l6D")

case cPrinter == "D"
// Move Down For Description fits on top of Bar

IF ! Empty(cDescr) // move down a little more
?13 " ",cDescr
FOR X:=1 TO 14
qqout(chr(13)+chr(10))
next
Endif
nHeight+=1

for h := 1 to nHeight
// QQOUT(SPACE(nColBegin))
for i := 1 to len(cToBar)
letter := substr(cToBar,i,1)

* build barcoded string
code := if(at(letter,chars)==0,letter,char[at(le
tter,chars)])
+ NS

* print barcode character at a time on Epson

// printcode(esc + chr(76) + chr(N1) + chr(N2) + code)
qqout(esc + chr(76) + chr(N1) + chr(N2) + code)
next

* perform 23/216 line feed

qqout(esc+chr(74)+chr(23)+chr(13))
//printcode(esc+chr(74)+chr(23)+chr(13))
next

* perform 5/216 line feed
QQout(esc+chr(74)+chr(1)+chr(13))

* reset cPrinter to turn off graphics and reset to 10cpi

qqout(esc+"2")
//// Line Spaceing Dot matrix
for x:=1 to nLinespace // Space after
qqout(chr(13)+chr(10))
next

endcase

return(nil)










"Robert J. Stuart" <rjstuart@earthlink.net> wrote in message
news:7kytf.651$%W1.593@newsread2.news.atl.earthlink.net...
> Mark, years ago I wrote some code to produce my own bar codes, numeric
> only, for a project I was working on. There was no bar code plug ins at

the
> time so I figured out the exact spacing of the vertical bars and spaces

and
> wrote a series of calls to produce this for both a HP laser jet using

PCL5e
> or PCL6 drivers. This is all for dos applications and worked pretty well
> for me for years. The code is a little bulky, I wrote it for S87 and

years
> before I learned to trim my code down. But I would be happy to share it
> with you and maybe you can clean it up and use it.
> Contact me at rjstuart@earthlink.net if you want it.
>
> Bob S.
>
>
> <mark@darbymetalinc.com> wrote in message
> news:1135974803.600859.257270@o13g2000cwo.googlegroups.com...
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com