Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing bar codes from Dbase3 program

Status
Not open for further replies.

jeannot

Programmer
May 17, 2001
12
LU
Hi,

we are running one very old Dbase III program ( written by the boss ), and he wants now to print bar codes out of this prog. So I need an old library ( or something similiar )
for Dbase III to be able to print the contents of one field as bar code.
I know there are programs able to import dbase files, but it has to be integrated in this program.

Does anyone know of such a library ( or possibly could sent it to me ) ?

many thanks
J. Martin
 
When I had worked at a video store (using DB3+, back in 93), my only resolution was to export the numbers to an ASCI file and then call another program using the ! or RUN statement(s) to activate it to read the text file to print out the 3OF7 format barcodes on an Epson 24-pin.

As far as I know, DB can't produce barcodes on it's own and I know of no libary available for such an output.

I believe the printing program was called 'omnibar' or something similar to that.

--MiggyD
 
One possibility that I considered was the export to a file ( this is much easier today as plenty of bar code programs are able to use dbase files, and there are libs available for Access etc), but my boss wants to print directly from his dbase program.
It seems to me that this is quit impossible and I get another argument for changing that old prog. :)

Jeannot
 
I'm curious if you have asked your boss, why s/he didn't include a barcode printing procedure in the past? Bet it was difficult then and more so now with other languages that can produce this request with little effort. Now you have to go "back to the drawing board."

Incorporating a barcode printing algorithm would be very hard to do, not to mention time consuming, but if s/he is willing to pay...

#1. You'll have to have a local printer; db3 was not designed for network printing.

#2. You'll have to get or change the character mapping protocols (dot matrix - usually Escape Sequence Codes {ESC}/jets & lasers - usually Printer Control Language {PCL}) but this may vary depending on market brand and model type.

#3. Write/re-write printing procedures to interpret DB3 values and convert to the printer's character protocols--mentioned in #2 above.

If, somehow, you can get #1 and #2 then you may have a finished product for him/her anywhere from 6 to 9 months (with debug testing and maybe some hair-pulling).

--MiggyD
 
Hello,

I have in use the next code for a Matrix and Laserjet printers ; will you help me with the syntax for a inktjet printer (zie below in this tread:*******************************************************************
* Testroutine CODE39DB.PRG Version: 1.0 *
* Author Modification: H.P.Schilder Date: 10-02-2002 *
* *
* Tested with: DBASE 5.0 FOR DOS Version date: 13-08-1994 *
* Operating System: DOS 7.10 32 bit FAT Multiboot configuration *
* for Windows 98 SE and it must also works with *
* Windows 2000 and Windows XP !!!!!!!!!!!!!!!!! *
* *
* Tested with: DBASE 4.0 FOR DOS Version date: ? *
* Operating System: Windows 95 B 32 bit FAT (DOS box) *
* *
* Created from: Clipper CODE39.PRG *
* Author : George T. Neill 2140 Main Street La Crosse, WI 54601 *
* Created: May 5, 1988 at 10:21 am (Public domain) *
* *
* Copyrights: *
* None, released to the public domain as is with no express *
* or implied warranty as to suitability or accuracy of this *
* program. The author shall not be held liable for any *
* damages, either direct or non-direct, arising from the use of *
* this program. This program may be modified and/or *
* included in any program without any consideration to the author.*
*******************************************************************
SET EXAC ON
SET PREC TO 20
SET DECI TO 0
SET STAT OFF
SET TALK OFF
SET PRIN TO LPT3
CLEA SCRE
PUBL ARRA char[44]
PUBL m_printer,m_height,h,i,nb,wb,ns,ws,n1,n2,m_cols,small_bar,wide_bar,dpl
PUBL code,chars,letter,cMessage,cEject
chars=" $%*+./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
m_printer='M'
m_height=2
@1,1 SAY 'Code 39 Barcode Generator'
@3,1 SAY 'Print Barcode op (M)atrix-, (L)aserjet-, (I)nktjet-printer ?' GET m_printer PICT '@!' VALI m_printer$'MLI'
@5,1 SAY 'Geef de Hoogte van de Barcode (1-4)' GET m_height PICT '9' RANGE 1,4
READ
IF m_printer='I'
* _pdriver='HPDESK.PR2'
** _pdriver='CANONLBP.PR2'
* SET PRIN ON
* ??? CHR(27)+"E" && initial dipswitch OF ZOIETS (ZIE DBASE BOEK)
* SET PRIN OFF
* DO PR_INKTJ && is nog niet gecreerd
ENDI
IF m_printer='L'
_pdriver='HPLASER.PR2'
SET PRIN ON
* ??? CHR(27)+"E" && initial dipswitch
SET PRIN OFF
small_bar=3 && number of points per bar
wide_bar=ROUN(small_bar*2.25,0) && 2.25 x small_bar
dpl=50 && dots per line 300dpi/6lpi = 50dpl
nb=CHR(27)+"*c"+TRAN(small_bar,'99')+"a"+LTRI(TRIM(STR(m_height*dpl)))+"b0P"+CHR(27)+"*p+"+TRAN(small_bar,'99')+"X"
wb=CHR(27)+"*c"+TRAN(wide_bar,'99')+"a"+LTRI(TRIM(STR(m_height*dpl)))+"b0P"+CHR(27)+"*p+"+TRAN(wide_bar,'99')+"X"
ns=CHR(27)+"*p+"+TRAN(small_bar,'99')+"X"
ws=CHR(27)+"*p+"+TRAN(wide_bar,'99')+"X"
ENDI
IF m_printer='M'
_pdriver='GENERIC.PR2'
SET PRIN ON
??? CHR(27)+CHR(64) && initial dipswitch
SET PRIN OFF
ns="{CTRL-@}"+"{CTRL-@}" && define Martrix-printer bars and spaces
ws="{CTRL-@}"+"{CTRL-@}"+"{CTRL-@}"+"{CTRL-@}" && define Matrix-printer bars and spaces
nb=CHR(255)
wb=CHR(255)+CHR(255)+CHR(255)
ENDI
DO DEF_CODE39 && Define CODE 3of9 Characer Set
DO WHIL .T.
cMessage=SPAC(25)
@7,1 SAY 'Geef de tekst voor de Barcode:'GET cMessage PICT '@K!'
READ
IF LEN(LTRI(TRIM(cMessage)))=0
RETU && exit on no cMessage text
ENDI
* cMessage='*'+TRIM(cMessage)+'*' && Prepend and append required asterik's to trimmed cMessage ***
cMessage=LTRI(TRIM(cMessage))
DO BARCODE
SET DEVICE TO PRIN
@PROW()+IIF(m_printer='L',m_height,0),INT(LEN(cMessage)/4) SAY cMessage && Print cMessage text below barcode
SET DEVICE TO SCRE
IF m_printer='M'
SET CONS OFF
SET PRIN ON
? && alleen voor Matrix-printer
SET PRIN OFF
SET CONS ON
ENDI
cEject=' '
@9,1 SAY 'Eject (J/N) ?' GET cEject PICT '@!' VALI cEject$'JN'
READ
IF cEject='J'
IF _pdriver='GENERIC.PR2' && Martrixprinter
SET PRIN ON
??? CHR(27)+CHR(64) && initial dipswitch
SET PRIN OFF
ENDI
IF _pdriver='HPLASER.PR2' && Laserjetprinter
SET PRIN ON
??? CHR(27)+"E" && initial dipswitch
SET PRIN OFF
ENDI
IF _pdriver='HPDESK.PR2' && Inktjetprinter
* IF _pdriver='CANONLBP.PR2' && Inktjetprinter
SET PRIN ON
??? CHR(27)+"E" && initial dipswitch
SET PRIN OFF
ENDI
EJEC && Check page eject (necessary to see what you've done on a laserjet)
RETU
ENDI
ENDD
SET STAT ON
RETU
******************************* PROCEDURE *************************************
*** 1
PROC BARCODE && Creates Code39 barcode from character string
code=''
DO CASE
CASE m_printer='I'
* Nog definieren
CASE m_printer='L'
code=CHR(27)+"*p-50Y" && adjust cusor position to start at top of line and return to bottom of line
DO PRINTCODE
i=1
DO WHIL i<=LEN(cMessage) && read cMessage character at a time and build barcode
letter=SUBS(cMessage,i,1)
code=IIF(AT(letter,chars)=0,letter,char[AT(letter,chars)])+ns && build barcoded string
** IF AT(letter,chars)=0
** code=letter+ns && als karakter NIET voorkomt in toegestane str chars
** ELSE
** code=char[AT(letter,chars)]+ns
** ENDI
i=i+1
DO PRINTCODE
ENDD
code=CHR(27)+&quot;*p+50Y&quot; && eind
DO PRINTCODE
CASE m_printer='M'
m_cols=21
n1=MOD(m_cols,256) && m_cols % 256 && modulus && calculate n1 value for dot graphics command
n2=INT(m_cols/256) && calculate n2 value for dot graphics command
code=(CHR(27)+CHR(51)+CHR(2)) && set printer to 2/216 lines per inch
DO PRINTCODE
h=1
DO WHIL h<=m_height
i=1
DO WHIL i<=LEN(cMessage)
letter=SUBS(cMessage,i,1)
code=IIF(AT(letter,chars)=0,letter,char[AT(letter,chars)])+ns && build barcoded string
IF n2=0
code=CHR(27)+CHR(76)+CHR(n1)+&quot;{CTRL-@}&quot;+code && note: if n2=0 you must send &quot;{CTRL-@}&quot;
ELSE
code=(CHR(27)+CHR(76)+CHR(n1)+CHR(n2)+code) && print barcode character at a time on Epson
ENDI
DO PRINTCODE
i=i+1
ENDD
code=(CHR(27)+CHR(74)+CHR(23)+CHR(13))
DO PRINTCODE
h=h+1
ENDD
code=(CHR(27)+CHR(74)+CHR(5)+CHR(13))
DO PRINTCODE
code=(CHR(27)+&quot;@&quot;)
DO PRINTCODE
ENDC
RETU
*** 2
PROC DEF_CODE39 && Define character set for CODE39
char[01]=nb+ws+wb+ns+nb+ns+wb+ns+nb && CHR(32) &quot; &quot;
char[02]=nb+ws+nb+ws+nb+ws+nb+ns+nb && CHR(36) &quot;$&quot;
char[03]=nb+ns+nb+ws+nb+ws+nb+ws+nb && CHR(37) &quot;%&quot;
char[04]=nb+ws+nb+ns+wb+ns+wb+ns+nb && CHR(42) &quot;*&quot;
char[05]=nb+ws+nb+ns+nb+ws+nb+ws+nb && CHR(43) &quot;+&quot;
char[06]=wb+ws+nb+ns+nb+ns+wb+ns+nb && CHR(46) &quot;.&quot;
char[07]=nb+ws+nb+ws+nb+ns+nb+ws+nb && CHR(47) &quot;/&quot;
char[08]=nb+ns+nb+ws+wb+ns+wb+ns+nb && CHR(48) &quot;0&quot;
char[09]=wb+ns+nb+ws+nb+ns+nb+ns+wb && CHR(49) &quot;1&quot;
char[10]=nb+ns+wb+ws+nb+ns+nb+ns+wb && CHR(50) &quot;2&quot;
char[11]=wb+ns+wb+ws+nb+ns+nb+ns+nb && CHR(51) &quot;3&quot;
char[12]=nb+ns+nb+ws+wb+ns+nb+ns+wb && CHR(52) &quot;4&quot;
char[13]=wb+ns+nb+ws+wb+ns+nb+ns+nb && CHR(53) &quot;5&quot;
char[14]=nb+ns+wb+ws+wb+ns+nb+ns+nb && CHR(54) &quot;6&quot;
char[15]=nb+ns+nb+ws+nb+ns+wb+ns+wb && CHR(55) &quot;7&quot;
char[16]=wb+ns+nb+ws+nb+ns+wb+ns+nb && CHR(56) &quot;8&quot;
char[17]=nb+ns+wb+ws+nb+ns+wb+ns+nb && CHR(57) &quot;9&quot;
char[18]=wb+ns+nb+ns+nb+ws+nb+ns+wb && CHR(65) &quot;A&quot;
char[19]=nb+ns+wb+ns+nb+ws+nb+ns+wb && CHR(66) &quot;B&quot;
char[20]=wb+ns+wb+ns+nb+ws+nb+ns+nb && CHR(67) &quot;C&quot;
char[21]=nb+ns+nb+ns+wb+ws+nb+ns+wb && CHR(68) &quot;D&quot;
char[22]=wb+ns+nb+ns+wb+ws+nb+ns+nb && CHR(69) &quot;E&quot;
char[23]=nb+ns+wb+ns+wb+ws+nb+ns+nb && CHR(70) &quot;F&quot;
char[24]=nb+ns+nb+ns+nb+ws+wb+ns+wb && CHR(71) &quot;G&quot;
char[25]=wb+ns+nb+ns+nb+ws+wb+ns+nb && CHR(72) &quot;H&quot;
char[26]=nb+ns+wb+ns+nb+ws+wb+ns+nb && CHR(73) &quot;I&quot;
char[27]=nb+ns+nb+ns+wb+ws+wb+ns+nb && CHR(74) &quot;J&quot;
char[28]=wb+ns+nb+ns+nb+ns+nb+ws+wb && CHR(75) &quot;K&quot;
char[29]=nb+ns+wb+ns+nb+ns+nb+ws+wb && CHR(76) &quot;L&quot;
char[30]=wb+ns+wb+ns+nb+ns+nb+ws+nb && CHR(77) &quot;M&quot;
char[31]=nb+ns+nb+ns+wb+ns+nb+ws+wb && CHR(78) &quot;N&quot;
char[32]=wb+ns+nb+ns+wb+ns+nb+ws+nb && CHR(79) &quot;O&quot;
char[33]=nb+ns+wb+ns+wb+ns+nb+ws+nb && CHR(80) &quot;P&quot;
char[34]=nb+ns+nb+ns+nb+ns+wb+ws+wb && CHR(81) &quot;Q&quot;
char[35]=wb+ns+nb+ns+nb+ns+wb+ws+nb && CHR(82) &quot;R&quot;
char[36]=nb+ns+wb+ns+nb+ns+wb+ws+nb && CHR(83) &quot;S&quot;
char[37]=nb+ns+nb+ns+wb+ns+wb+ws+nb && CHR(84) &quot;T&quot;
char[38]=wb+ws+nb+ns+nb+ns+nb+ns+wb && CHR(85) &quot;U&quot;
char[39]=nb+ws+wb+ns+nb+ns+nb+ns+wb && CHR(86) &quot;V&quot;
char[40]=wb+ws+wb+ns+nb+ns+nb+ns+nb && CHR(87) &quot;W&quot;
char[41]=nb+ws+nb+ns+wb+ns+nb+ns+wb && CHR(88) &quot;X&quot;
char[42]=wb+ws+nb+ns+wb+ns+nb+ns+nb && CHR(89) &quot;Y&quot;
char[43]=nb+ws+wb+ns+wb+ns+nb+ns+nb && CHR(90) &quot;Z&quot;
char[44]=nb+ws+nb+ns+nb+ns+wb+ns+wb && CHR(95) &quot;-&quot;
RETU
*** 3
PROC PRINTCODE && Sends escape codes to printer
@15,0 SAY code COLO W+/R
SET CONS OFF
SET PRIN ON
??? code
SET PRIN OFF
SET CONS ON
RETU


Soundmix Show
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top