>Have you had any experiences printing labels?
>
>Regards. Al
Hi, Al. Do I recognize your name from the VFE conference?
I've attached a program which I wrote following suggestions on UT. It has helped me quite a bit with large printing runs.
The general idea is to prepare a character string which contains an exact image of what you want to print. Just printable characters. Then stuff that string into a memo field of a record of the SPOOLR file. When the file is finished, you use this PRSPOOLR program to do the actual printing.
I must confess that I have not gone back and rewritten my label printing program (which gives me fits also) to use this new approach. But I see no reason it should not work as well for labels as for billing statements.
Peter Robinson
P.S.
This programs works best on a Novell network when there is capture statement in effect to direct the output to a printer.
Attachment:
***********************************************************************
* PROCEDURE PRSPOOLR.PRG
***********************************************************************
* Purpose.....: Print the images for one batch in the SPOOLR file.
* Parameters..: tiBATCHS -- Batch to print
* Calls.......: PrintIt() [here]
* Data Session: default
* Opens.......:
* Updates.....: BATCHS, SPOOLR
* Uses........:
* Closes......: none
* Project.....: MassOne Timeshare System
* Version.....: 1.0
* Platform....: Visual FoxPro 5.0
* Author......: Peter Robinson
* Copyright...: (c) Rodes Software, 1998
* Created.....: 1998.11.15
* History.....:
&& 1999.01.07 Add second attempt: "pnFHandle = fopen("PRN",11)"
&& 1999.01.07 Consolidate Options within file loop.
&& 1999.01.16 Drop SPOOLR.tReprinted field.
&& 1999.01.20 Fix bug in PrintIt()
&& 1999.01.21 Don't increment piPrinted if record already printed.
&& 1999.01.21 Add automatic pause to to start network spooler.
**********************************************************************
lparameters tiBATCHS
local liBATCHS
local ltPrinted && Start with image printed at ltPrinted.
local lnChars && number of characters written
private pnFHandle && file handle for low-level write to printer
private piCount && 1999.01.20 number of images to print
private piPrinted && 1999.01.20 number of images printed
private pcInput && character entered by operator
private pcRecord && 1999.01.20 Display record data
#define hcCRLF chr(13)+chr(10)
#define hcNewPage chr(12)
pcInput = ""
set printer to
close all && close low-level files
pnFHandle = fopen("\PRN",11)
if pnFHandle<=0
pnFHandle = fopen("PRN",11) && 1999.01.07
endif
if pnFHandle<=0
=Msg_RS("
.")
return .f.
endif
if type("tiBATCHS") <> "N"
Msg_RS("PRSPOOLR: tiBATCHS", "W")
return .f.
endif
glAbort_RS = .f.
if not OpenF_RS("BATCHS")
Msg_RS("PRSPOOLR: BATCHS table", "W")
return .f.
endif
set order to iBATCHS
if not OpenF_RS("SPOOLR")
Msg_RS("PRSPOOLR: SPOOLR table", "W")
return .f.
endif
select SPOOLR
count for iBATCHS=tiBATCHS to piCount
count for iBATCHS=tiBATCHS and not empty(tPrinted) to piPrinted
set order to cOrder
set relation to iBATCHS into BATCHS
set filter to iBATCHS=tiBATCHS
locate for empty(SPOOLR.tPrinted)
if eof()
locate
endif
do while not eof()
if not pcInput $ "EG"
pcInput = Msg_RS("Next: " + alltrim(SPOOLR.cOrder) ;
+ " Press B-Browse, E-Errors Only, G-Go, P-Print 1, " ;
+ "S-Skip, T-Test Print, or Q-Quit.", "WQ")
endif
do case
case pcInput = "B"
browse fields BATCHS.cUserId, ;
iACCNTS, cOrder, yAmount, ;
mImage, mErrors, tPrinted, tSkipped
loop
case pcInput = "E"
wait window nowait "Checking " + alltrim(cOrder) ;
+ " for errors."
if empty(mErrors)
skip
loop
endif
if not PrintIt()
return
endif
skip
loop
case pcInput = "G"
if not PrintIt()
return
endif
skip
loop
case pcInput = "P"
if not PrintIt()
return
endif
skip
loop
case pcInput = "S"
skip
loop
case pcInput = "T"
if not PrintIt(.t.) && Test Print
return
endif
loop
case pcInput = "Q"
exit
otherwise
loop
endcase
enddo
select SPOOLR
set filter to
=fclose(pnFHandle)
return .t.
***********************************************************************
* FUNCTION PrintIt
***********************************************************************
* Purpose.....:
* Parameters..: tlTest
* Returns.....:
procedure PrintIt
lparameter tlTest
local lcString, llTest
local lcInput && 1999.01.20
if type("tlTest")="L"
llTest = tlTest
else
llTest = .f.
endif
if not empty(SPOOLR.mImage)
lcString = SPOOLR.mImage + hcNewPage
*!* ??? lcString
lnChars = fwrite(pnFHandle,lcString)
**lnChars = 100
endif
if lnChars=0
=Msg_RS("Can't print. Correct problem and restart.","WL")
return .f.
endif
if not empty(SPOOLR.mErrors)
lcString ;
= SPOOLR.mErrors + hcCRLF + hcCRLF ;
+ "*** Errors found on previous form!" + hcCRLF ;
+ "*** " + SPOOLR.cOrder + hcCRLF ;
+ "*** " + ttoc(datetime()) ;
+ chr(12)
lnChars = fwrite(pnFHandle,lcString)
**lnChars = 100
endif
if lnChars=0
=Msg_RS("Can't print. Correct problem and restart.","WL")
return .f.
endif
if not llTest
*RS 1999.01.21 SYS {
if empty(tPrinted)
piPrinted = piPrinted + 1
endif
*RS 1999.01.21 }
replace tPrinted with datetime()
wait window ;
alltrim(SPOOLR.cOrder) ;
+ " Completed " + alltrim(str(piPrinted)) ;
+ " of " + alltrim(str(piCount)) ;
+ " Press the space bar to pause." ;
to lcInput timeout .2
if len(lcInput)>0
pcInput = " "
endif
endif
*RS 1999.01.21 SYS {
if piPrinted = 10 or piPrinted = 100 ;
or (piPrinted>100 and piPrinted % 500 = 0) && 99.02.10
wait window ;
+ " Completed " + alltrim(str(piPrinted)) ;
+ " of " + alltrim(str(piCount)) ;
+ " Pausing for 20 seconds to start network spooler." ;
to lcInput timeout 20
endif
*RS 1999.01.21 }
return .t.
endproc
Peter Robinson ** Rodes Design ** Virginia