I have a question concerning the best way to handle the following issue. (Please See Code)
I use the value of y to position the row position of the printed lines.
I use your library to send varying amounts of data to be printed out via your library. I have it set so that when ever
the amount printed passes the y > 200 position, a Print_NewPage() is triggered, and the next data is
continued page by page until done. It works great!
If printed data is not greater than the y > 200 position, it works great too.
But,,, if y > 200 position, and a Print_NewPage() is triggered, with no more data to be printed, it either
does nothing, or locks up my printer. What is the best way to handle this or kill the Print_NewPage() that was called
when this happens? Nothing I tried seems to work once the Print_NewPage() is called. I can send blank line data
before calling Print_StopPrinting(), but having it always print out an extra blank unused page when this happens is
irritating to my clients.
Thanks for any help or ideas.
yrreti
The code below uses For x= 1 To 49, 50, 51 to simulate different data amounts being entered to show my problem.
Code: Select all
Procedure Print_This()
;Note: You will need to enter your own printer name for selprn$
selprn$="EPSON WorkForce 610 Series"
If Print_OpenPrinter(selprn$,"PAPERSIZE="+Str(#DMPAPER_LETTER)+",ORIENTATION="+Str(#DMORIENT_PORTRAIT))
Print_StartPrinting("MyData")
Print_Font("Lucida Console",8, #PB_Font_HighQuality)
y = 4; initial Y position
;Notes:
;For x= 1 To 49 works fine because it's not greater then 200 and Print_NewPage() is not triggered
;and Print_StopPrinting() is called and printer prints one blank page.
;For x= 1 To 51 works fine because it's more then 200 and Print_NewPage() is triggered,
;and more is printed before Print_StopPrinting() is called and printer prints two blank pages.
;For x= 1 To 50 FAILS and either does nothing or LOCKS UP the PRINTER.
;Because it's more then 200, a Print_NewPage() is triggered.
;But nothing more is printed before Print_StopPrinting() is called, and the printer either does nothing,
;or locks up and prints nothing. (Obviously waiting for data for the next page.)
For x= 1 To 50
Print_Text(5,y, " "):y=y+4 ;printing blank lines to save paper
;Print_Text(5,y, "Y count = "+Str(y)):y=y+4
Debug "x count = "+Str(x)+" Y count = "+Str(y)
If y>200 ;setting switch to a new page when it gets above this position value of y
Print_NewPage()
y=4
EndIf
Next x
;This stops the print job.
Print_StopPrinting() ;Ends a print job.
Else
err$=Print_GetLastError()
MessageRequester(" Print_StartPrinting()",err$,0)
EndIf
EndProcedure
Print_This()