Author | Topic: ISPRINTER curiosity behaviour | |
---|---|---|
Wojciech Karcz | ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 12:44:14 +0200 Windows XT or Windows NT 2000 NOVELL ??? Alaska 1.90.331 First time in my experience with alaska (and clipper since 1986) happened below : function ISPRINTER( 'LPT1' ) hangt program - only Task Menager and End Task (3 time) stops program but ISPRINTER('LPT2'). ..lpt3, lpt4, com1, ....com4 return properly TRUE Any sugestion, solve or help ? Best regards for all | |
Jorge L | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 08:25:41 -0300 Hi in my little experience with Alaska i use xbpprinter() but in clipper i create my own IsPrinter() was very basic... Function DetImpre( pPORT ) Local A2, A3, A4, RET :=.t. A3 :=Set( _SET_DEVICE, 'PRINTER' ) A2 :=Set( _SET_PRINTFILE, pPORT ) A4 :=ErrorBlock() BEGIN SEQUENCE SetPRC( 0, 0 ) DevOut( MyInitPrinter( M->IMPRESORA ) ) RECOVER USING A4 Alert( 'Error en Impresora !' ) RET :=.f. END SEQUENCE ErrorBlock( A4 ) Set( _SET_DEVICE, A2 ) Set( _SET_PRINTER, A3 ) Return ( RET ) regards "Wojciech Karcz" <wojtekkarcz@interia.pl> escribió en el mensaje de noticias news:4bbf8fa3$11718c3d$44463@news.alaska-software.com... > Windows XT or Windows NT 2000 > NOVELL ??? > Alaska 1.90.331 > > First time in my experience with alaska (and clipper since 1986) > happened > below : > > function ISPRINTER( 'LPT1' ) hangt program - only Task Menager and End > Task > (3 time) stops program > > but ISPRINTER('LPT2'). ..lpt3, lpt4, com1, ....com4 return properly > TRUE > > Any sugestion, solve or help ? > > Best regards for all > > > | |
Joe Carrick | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 06:16:44 -0700 The docs say: Description The environment function IsPrinter() tests the readiness of an output device connected to a print or output channel. The function tests LPT1 to LPT<n> or COM1 to COM<n>. When no argument is specified, the readiness of LPT1 is tested. Caution When print output occurs using the spooler or print queue, IsPrinter() reports the readiness of the spooler and not of the physical printer. In this situation the function generally returns the value .T. (true). If the actual output device is not ready, the condition is reported by the operating system. //////////////////////////////// IOW, you can't depend on the IsPrinter function to tell you if the printer is ready - it will most likely report the status of the spooler or print queue. Most printing in Xbase++ is done using an XbpPrinter object and Gra.... functions. It gives much greater flexibility and if done in a separate thread will result in much quicker return of program control to the user. -Joe Wojciech Karcz wrote: > Windows XT or Windows NT 2000 > NOVELL ??? > Alaska 1.90.331 > > First time in my experience with alaska (and clipper since 1986) happened > below : > > function ISPRINTER( 'LPT1' ) hangt program - only Task Menager and End Task > (3 time) stops program > > but ISPRINTER('LPT2'). ..lpt3, lpt4, com1, ....com4 return properly > TRUE > > Any sugestion, solve or help ? > > Best regards for all > > > | |
Jack Duijf | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 19:02:14 +0200 Hello, As mentioned before, you can use xbpPrinter. The code below works ok for me. The best part is that you do not have to know wich port the printer is assigned. You can even print raw data (escape sequences) as you did in clipper. Make sure you haven the correct printerdriver installed. Regards, Jack Duijf #define XBPPRN_STATUS_PAUSED 0 #define XBPPRN_STATUS_READY 1 #define XBPPRN_STATUS_BUSY (-1) #define XBPPRN_STATUS_SERVICE (-2) #define XBPPRN_STATUS_NOPAPER (-3) #define XBPPRN_STATUS_NOT_READY (-4) #define XBPPRN_STATUS_NA (-5) #define XBPPRN_STATUS_ERROR (-6) #define XBPPRN_STATUS_OFFLINE (-7) Function Test_Printer(cPrinter) LOCAL aList := xbpPrinter():New():List() LOCAL oPrinter := nil LOCAL nStatus := nil LOCAL cMsg := "" if ValType(aList) <> "A" aList := {} endif aList is a list of availeble printers. Now we open the first printer in the list (if none defined in cPrinter): if Len(aList) >0 At least 1 printer is availeble on this machine. Default cPrinter to aList[1] oPrinter := xbpPrinter():New():Create(cPrinter) nStatus := oPrinter:PrinterStatus() cMsg := "" do while nStatus <> XBPPRN_STATUS_READY do case case nStatus = XBPPRN_STATUS_OFFLINE cMsg := "is off line." case nStatus = XBPPRN_STATUS_NOPAPER cMsg := "out of paper." case nStatus = .... See other constants cMsg := "out of paper." otherwise cMsg := "not ready." endcase cMsg :=AllTrim(oPrinter:devname) + CR + cMsg MsgBox(cMsg) nStatus := oPrinter:PrinterStatus() Enddo And now print some raw data as we did in clipper. SET PRINTER TO OBJECT oPrinter SET PRINTER ON SET CONSOLE OFF ?? Chr(27) + Chr(..) + Chr(..) ? "Hello on a printer page"" @ 10,10 say "Any other text" SET CONSOLE ON SET PRINTER OFF SET PRINTER TO endif Return oPrinter | |
Carlos A Beling | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 15:30:40 -0300 Hello Jack: good afternoon. Second my understanding, your function is printing using QQOut() and QOut() and control chars for any printer, including USB printers. Does it really work ok with USB printers? Beling TIA Jack Duijf escreveu: > Hello, > > As mentioned before, you can use xbpPrinter. > The code below works ok for me. > The best part is that you do not have to know wich port the printer is > assigned. > You can even print raw data (escape sequences) as you did in clipper. > Make sure you haven the correct printerdriver installed. > > Regards, > Jack Duijf > > > #define XBPPRN_STATUS_PAUSED 0 > #define XBPPRN_STATUS_READY 1 > #define XBPPRN_STATUS_BUSY (-1) > #define XBPPRN_STATUS_SERVICE (-2) > #define XBPPRN_STATUS_NOPAPER (-3) > #define XBPPRN_STATUS_NOT_READY (-4) > #define XBPPRN_STATUS_NA (-5) > #define XBPPRN_STATUS_ERROR (-6) > #define XBPPRN_STATUS_OFFLINE (-7) > > Function Test_Printer(cPrinter) > LOCAL aList := xbpPrinter():New():List() > LOCAL oPrinter := nil > LOCAL nStatus := nil > LOCAL cMsg := "" > if ValType(aList) <> "A" > aList := {} > endif > > aList is a list of availeble printers. > Now we open the first printer in the list (if none defined in cPrinter): > > if Len(aList) >0 At least 1 printer is availeble on this machine. > Default cPrinter to aList[1] > oPrinter := xbpPrinter():New():Create(cPrinter) > nStatus := oPrinter:PrinterStatus() > cMsg := "" > do while nStatus <> XBPPRN_STATUS_READY > do case > case nStatus = XBPPRN_STATUS_OFFLINE > cMsg := "is off line." > case nStatus = XBPPRN_STATUS_NOPAPER > cMsg := "out of paper." > case nStatus = .... See other constants > cMsg := "out of paper." > otherwise > cMsg := "not ready." > endcase > cMsg :=AllTrim(oPrinter:devname) + CR + cMsg > MsgBox(cMsg) > nStatus := oPrinter:PrinterStatus() > Enddo > > And now print some raw data as we did in clipper. > > SET PRINTER TO OBJECT oPrinter > SET PRINTER ON > SET CONSOLE OFF > ?? Chr(27) + Chr(..) + Chr(..) > ? "Hello on a printer page"" > @ 10,10 say "Any other text" > SET CONSOLE ON > SET PRINTER OFF > SET PRINTER TO > > endif > Return oPrinter > > | |
Joe Carrick | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 11:40:58 -0700 Absolutely! Windows handles it automatically regardless of what port the printer is connected to. -Joe Carlos A Beling wrote: > Hello Jack: > good afternoon. > Second my understanding, your function is printing using QQOut() and > QOut() and control chars for any printer, including USB printers. > Does it really work ok with USB printers? > > Beling > TIA > > Jack Duijf escreveu: >> Hello, >> >> As mentioned before, you can use xbpPrinter. >> The code below works ok for me. >> The best part is that you do not have to know wich port the printer is >> assigned. >> You can even print raw data (escape sequences) as you did in clipper. >> Make sure you haven the correct printerdriver installed. >> >> Regards, >> Jack Duijf >> >> >> #define XBPPRN_STATUS_PAUSED 0 >> #define XBPPRN_STATUS_READY 1 >> #define XBPPRN_STATUS_BUSY (-1) >> #define XBPPRN_STATUS_SERVICE (-2) >> #define XBPPRN_STATUS_NOPAPER (-3) >> #define XBPPRN_STATUS_NOT_READY (-4) >> #define XBPPRN_STATUS_NA (-5) >> #define XBPPRN_STATUS_ERROR (-6) >> #define XBPPRN_STATUS_OFFLINE (-7) >> >> Function Test_Printer(cPrinter) >> LOCAL aList := xbpPrinter():New():List() >> LOCAL oPrinter := nil >> LOCAL nStatus := nil >> LOCAL cMsg := "" >> if ValType(aList) <> "A" >> aList := {} >> endif >> >> aList is a list of availeble printers. >> Now we open the first printer in the list (if none defined in >> cPrinter): >> >> if Len(aList) >0 At least 1 printer is availeble on this machine. >> Default cPrinter to aList[1] >> oPrinter := xbpPrinter():New():Create(cPrinter) >> nStatus := oPrinter:PrinterStatus() >> cMsg := "" >> do while nStatus <> XBPPRN_STATUS_READY >> do case >> case nStatus = XBPPRN_STATUS_OFFLINE >> cMsg := "is off line." >> case nStatus = XBPPRN_STATUS_NOPAPER >> cMsg := "out of paper." >> case nStatus = .... See other constants >> cMsg := "out of paper." >> otherwise >> cMsg := "not ready." >> endcase >> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >> MsgBox(cMsg) >> nStatus := oPrinter:PrinterStatus() >> Enddo >> >> And now print some raw data as we did in clipper. >> >> SET PRINTER TO OBJECT oPrinter >> SET PRINTER ON >> SET CONSOLE OFF >> ?? Chr(27) + Chr(..) + Chr(..) >> ? "Hello on a printer page"" >> @ 10,10 say "Any other text" >> SET CONSOLE ON >> SET PRINTER OFF >> SET PRINTER TO >> >> endif >> Return oPrinter >> >> | |
Carlos A Beling | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 18:40:34 -0300 Hello Joe: good night. Very, very interesting. Does it mean that nobody needs converting @ Say... to graphic coordinates when using XbpPrinter()? Beling Best regards Joe Carrick escreveu: > Absolutely! Windows handles it automatically regardless of what port > the printer is connected to. > > -Joe > > Carlos A Beling wrote: >> Hello Jack: >> good afternoon. >> Second my understanding, your function is printing using QQOut() and >> QOut() and control chars for any printer, including USB printers. >> Does it really work ok with USB printers? >> >> Beling >> TIA >> >> Jack Duijf escreveu: >>> Hello, >>> >>> As mentioned before, you can use xbpPrinter. >>> The code below works ok for me. >>> The best part is that you do not have to know wich port the printer >>> is assigned. >>> You can even print raw data (escape sequences) as you did in clipper. >>> Make sure you haven the correct printerdriver installed. >>> >>> Regards, >>> Jack Duijf >>> >>> >>> #define XBPPRN_STATUS_PAUSED 0 >>> #define XBPPRN_STATUS_READY 1 >>> #define XBPPRN_STATUS_BUSY (-1) >>> #define XBPPRN_STATUS_SERVICE (-2) >>> #define XBPPRN_STATUS_NOPAPER (-3) >>> #define XBPPRN_STATUS_NOT_READY (-4) >>> #define XBPPRN_STATUS_NA (-5) >>> #define XBPPRN_STATUS_ERROR (-6) >>> #define XBPPRN_STATUS_OFFLINE (-7) >>> >>> Function Test_Printer(cPrinter) >>> LOCAL aList := xbpPrinter():New():List() >>> LOCAL oPrinter := nil >>> LOCAL nStatus := nil >>> LOCAL cMsg := "" >>> if ValType(aList) <> "A" >>> aList := {} >>> endif >>> >>> aList is a list of availeble printers. >>> Now we open the first printer in the list (if none defined in >>> cPrinter): >>> >>> if Len(aList) >0 At least 1 printer is availeble on this machine. >>> Default cPrinter to aList[1] >>> oPrinter := xbpPrinter():New():Create(cPrinter) >>> nStatus := oPrinter:PrinterStatus() >>> cMsg := "" >>> do while nStatus <> XBPPRN_STATUS_READY >>> do case >>> case nStatus = XBPPRN_STATUS_OFFLINE >>> cMsg := "is off line." >>> case nStatus = XBPPRN_STATUS_NOPAPER >>> cMsg := "out of paper." >>> case nStatus = .... See other constants >>> cMsg := "out of paper." >>> otherwise >>> cMsg := "not ready." >>> endcase >>> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >>> MsgBox(cMsg) >>> nStatus := oPrinter:PrinterStatus() >>> Enddo >>> >>> And now print some raw data as we did in clipper. >>> >>> SET PRINTER TO OBJECT oPrinter >>> SET PRINTER ON >>> SET CONSOLE OFF >>> ?? Chr(27) + Chr(..) + Chr(..) >>> ? "Hello on a printer page"" >>> @ 10,10 say "Any other text" >>> SET CONSOLE ON >>> SET PRINTER OFF >>> SET PRINTER TO >>> >>> endif >>> Return oPrinter >>> >>> | |
Joe Carrick | Re: ISPRINTER curiosity behaviour on Thu, 13 Aug 2009 16:00:56 -0700 Well...... only if you are really happy with simple text output and no (or at least very little) control of fonts, spacing, etc. Personally, I like to provide much more "Pizzazz" in my printed output. Carlos A Beling wrote: > Hello Joe: > good night. > Very, very interesting. > Does it mean that nobody needs converting @ Say... to graphic > coordinates when using XbpPrinter()? > > Beling > Best regards > > Joe Carrick escreveu: >> Absolutely! Windows handles it automatically regardless of what port >> the printer is connected to. >> >> -Joe >> >> Carlos A Beling wrote: >>> Hello Jack: >>> good afternoon. >>> Second my understanding, your function is printing using QQOut() and >>> QOut() and control chars for any printer, including USB printers. >>> Does it really work ok with USB printers? >>> >>> Beling >>> TIA >>> >>> Jack Duijf escreveu: >>>> Hello, >>>> >>>> As mentioned before, you can use xbpPrinter. >>>> The code below works ok for me. >>>> The best part is that you do not have to know wich port the printer >>>> is assigned. >>>> You can even print raw data (escape sequences) as you did in clipper. >>>> Make sure you haven the correct printerdriver installed. >>>> >>>> Regards, >>>> Jack Duijf >>>> >>>> >>>> #define XBPPRN_STATUS_PAUSED 0 >>>> #define XBPPRN_STATUS_READY 1 >>>> #define XBPPRN_STATUS_BUSY (-1) >>>> #define XBPPRN_STATUS_SERVICE (-2) >>>> #define XBPPRN_STATUS_NOPAPER (-3) >>>> #define XBPPRN_STATUS_NOT_READY (-4) >>>> #define XBPPRN_STATUS_NA (-5) >>>> #define XBPPRN_STATUS_ERROR (-6) >>>> #define XBPPRN_STATUS_OFFLINE (-7) >>>> >>>> Function Test_Printer(cPrinter) >>>> LOCAL aList := xbpPrinter():New():List() >>>> LOCAL oPrinter := nil >>>> LOCAL nStatus := nil >>>> LOCAL cMsg := "" >>>> if ValType(aList) <> "A" >>>> aList := {} >>>> endif >>>> >>>> aList is a list of availeble printers. >>>> Now we open the first printer in the list (if none defined in >>>> cPrinter): >>>> >>>> if Len(aList) >0 At least 1 printer is availeble on this machine. >>>> Default cPrinter to aList[1] >>>> oPrinter := xbpPrinter():New():Create(cPrinter) >>>> nStatus := oPrinter:PrinterStatus() >>>> cMsg := "" >>>> do while nStatus <> XBPPRN_STATUS_READY >>>> do case >>>> case nStatus = XBPPRN_STATUS_OFFLINE >>>> cMsg := "is off line." >>>> case nStatus = XBPPRN_STATUS_NOPAPER >>>> cMsg := "out of paper." >>>> case nStatus = .... See other constants >>>> cMsg := "out of paper." >>>> otherwise >>>> cMsg := "not ready." >>>> endcase >>>> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >>>> MsgBox(cMsg) >>>> nStatus := oPrinter:PrinterStatus() >>>> Enddo >>>> >>>> And now print some raw data as we did in clipper. >>>> >>>> SET PRINTER TO OBJECT oPrinter >>>> SET PRINTER ON >>>> SET CONSOLE OFF >>>> ?? Chr(27) + Chr(..) + Chr(..) >>>> ? "Hello on a printer page"" >>>> @ 10,10 say "Any other text" >>>> SET CONSOLE ON >>>> SET PRINTER OFF >>>> SET PRINTER TO >>>> >>>> endif >>>> Return oPrinter >>>> >>>> | |
Carlos A Beling | Re: ISPRINTER curiosity behaviour on Sat, 15 Aug 2009 10:33:00 -0300 Hello Joe: good morning. I wrote a printer class where I can printing images and other "pizzas". But it is very, very interesting . Beling Cheers Joe Carrick escreveu: > Well...... only if you are really happy with simple text output and no > (or at least very little) control of fonts, spacing, etc. > > Personally, I like to provide much more "Pizzazz" in my printed output. > > > > Carlos A Beling wrote: >> Hello Joe: >> good night. >> Very, very interesting. >> Does it mean that nobody needs converting @ Say... to graphic >> coordinates when using XbpPrinter()? >> >> Beling >> Best regards >> >> Joe Carrick escreveu: >>> Absolutely! Windows handles it automatically regardless of what port >>> the printer is connected to. >>> >>> -Joe >>> >>> Carlos A Beling wrote: >>>> Hello Jack: >>>> good afternoon. >>>> Second my understanding, your function is printing using QQOut() and >>>> QOut() and control chars for any printer, including USB printers. >>>> Does it really work ok with USB printers? >>>> >>>> Beling >>>> TIA >>>> >>>> Jack Duijf escreveu: >>>>> Hello, >>>>> >>>>> As mentioned before, you can use xbpPrinter. >>>>> The code below works ok for me. >>>>> The best part is that you do not have to know wich port the printer >>>>> is assigned. >>>>> You can even print raw data (escape sequences) as you did in clipper. >>>>> Make sure you haven the correct printerdriver installed. >>>>> >>>>> Regards, >>>>> Jack Duijf >>>>> >>>>> >>>>> #define XBPPRN_STATUS_PAUSED 0 >>>>> #define XBPPRN_STATUS_READY 1 >>>>> #define XBPPRN_STATUS_BUSY (-1) >>>>> #define XBPPRN_STATUS_SERVICE (-2) >>>>> #define XBPPRN_STATUS_NOPAPER (-3) >>>>> #define XBPPRN_STATUS_NOT_READY (-4) >>>>> #define XBPPRN_STATUS_NA (-5) >>>>> #define XBPPRN_STATUS_ERROR (-6) >>>>> #define XBPPRN_STATUS_OFFLINE (-7) >>>>> >>>>> Function Test_Printer(cPrinter) >>>>> LOCAL aList := xbpPrinter():New():List() >>>>> LOCAL oPrinter := nil >>>>> LOCAL nStatus := nil >>>>> LOCAL cMsg := "" >>>>> if ValType(aList) <> "A" >>>>> aList := {} >>>>> endif >>>>> >>>>> aList is a list of availeble printers. >>>>> Now we open the first printer in the list (if none defined in >>>>> cPrinter): >>>>> >>>>> if Len(aList) >0 At least 1 printer is availeble on this machine. >>>>> Default cPrinter to aList[1] >>>>> oPrinter := xbpPrinter():New():Create(cPrinter) >>>>> nStatus := oPrinter:PrinterStatus() >>>>> cMsg := "" >>>>> do while nStatus <> XBPPRN_STATUS_READY >>>>> do case >>>>> case nStatus = XBPPRN_STATUS_OFFLINE >>>>> cMsg := "is off line." >>>>> case nStatus = XBPPRN_STATUS_NOPAPER >>>>> cMsg := "out of paper." >>>>> case nStatus = .... See other constants >>>>> cMsg := "out of paper." >>>>> otherwise >>>>> cMsg := "not ready." >>>>> endcase >>>>> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >>>>> MsgBox(cMsg) >>>>> nStatus := oPrinter:PrinterStatus() >>>>> Enddo >>>>> >>>>> And now print some raw data as we did in clipper. >>>>> >>>>> SET PRINTER TO OBJECT oPrinter >>>>> SET PRINTER ON >>>>> SET CONSOLE OFF >>>>> ?? Chr(27) + Chr(..) + Chr(..) >>>>> ? "Hello on a printer page"" >>>>> @ 10,10 say "Any other text" >>>>> SET CONSOLE ON >>>>> SET PRINTER OFF >>>>> SET PRINTER TO >>>>> >>>>> endif >>>>> Return oPrinter >>>>> >>>>> | |
Jack Duijf | Re: ISPRINTER curiosity behaviour on Sat, 15 Aug 2009 12:03:40 +0200 Hallo Carlos, You send any sequence to any printer, and bypass the windows driver. You should be aware that the actual sequence should be supported by the printer. Personaly i use these to controll the card movement of Cardprinters like Zebra and Evolis with Mifare card-readers. 1. Get 1 from the stack 2. Move card to the reader 3. Read/Write Mifare card 4. Move card back to the start of print position. Then i close the xbpprinter, and print the text on the card using Express++ Some USB printers do not support PCL codes or any plain ACSII strings, but just accept graphic data, Regards, Jack Duijf "Carlos A Beling" <beling@bipbip.com.br> schreef in bericht news:4061a9f1$4e03f409$49f75@news.alaska-software.com... > Hello Jack: > good afternoon. > Second my understanding, your function is printing using QQOut() and > QOut() and control chars for any printer, including USB printers. > Does it really work ok with USB printers? > > Beling > TIA > > Jack Duijf escreveu: >> Hello, >> >> As mentioned before, you can use xbpPrinter. >> The code below works ok for me. >> The best part is that you do not have to know wich port the printer is >> assigned. >> You can even print raw data (escape sequences) as you did in clipper. >> Make sure you haven the correct printerdriver installed. >> >> Regards, >> Jack Duijf >> >> >> #define XBPPRN_STATUS_PAUSED 0 >> #define XBPPRN_STATUS_READY 1 >> #define XBPPRN_STATUS_BUSY (-1) >> #define XBPPRN_STATUS_SERVICE (-2) >> #define XBPPRN_STATUS_NOPAPER (-3) >> #define XBPPRN_STATUS_NOT_READY (-4) >> #define XBPPRN_STATUS_NA (-5) >> #define XBPPRN_STATUS_ERROR (-6) >> #define XBPPRN_STATUS_OFFLINE (-7) >> >> Function Test_Printer(cPrinter) >> LOCAL aList := xbpPrinter():New():List() >> LOCAL oPrinter := nil >> LOCAL nStatus := nil >> LOCAL cMsg := "" >> if ValType(aList) <> "A" >> aList := {} >> endif >> >> aList is a list of availeble printers. >> Now we open the first printer in the list (if none defined in >> cPrinter): >> >> if Len(aList) >0 At least 1 printer is availeble on this machine. >> Default cPrinter to aList[1] >> oPrinter := xbpPrinter():New():Create(cPrinter) >> nStatus := oPrinter:PrinterStatus() >> cMsg := "" >> do while nStatus <> XBPPRN_STATUS_READY >> do case >> case nStatus = XBPPRN_STATUS_OFFLINE >> cMsg := "is off line." >> case nStatus = XBPPRN_STATUS_NOPAPER >> cMsg := "out of paper." >> case nStatus = .... See other constants >> cMsg := "out of paper." >> otherwise >> cMsg := "not ready." >> endcase >> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >> MsgBox(cMsg) >> nStatus := oPrinter:PrinterStatus() >> Enddo >> >> And now print some raw data as we did in clipper. >> >> SET PRINTER TO OBJECT oPrinter >> SET PRINTER ON >> SET CONSOLE OFF >> ?? Chr(27) + Chr(..) + Chr(..) >> ? "Hello on a printer page"" >> @ 10,10 say "Any other text" >> SET CONSOLE ON >> SET PRINTER OFF >> SET PRINTER TO >> >> endif >> Return oPrinter >> | |
Carlos A Beling | Re: ISPRINTER curiosity behaviour on Sat, 15 Aug 2009 10:52:08 -0300 Hello Jack: good morning. Thaks you. I had many troubles trying using USB printers and new one that neither uses PCL nor escape sequences. It was not possible printing in other way different graphic printing. So I wrote a class that: . uses tokens (ie: Chr(27) + meaning + token description). Many of them already are used in @ ... Say ... . I used the preprocessor for converting @ ... Say to a funcion cal passing the same parameters as QOut() or QQOut() . The function translates in the string the found tokens into others that can be used in graphic printing and writes the new one string into a file . The file is read by a thread that search for the tokens, translate them and prints. Beling Best regards Jack Duijf escreveu: > Hallo Carlos, > > You send any sequence to any printer, and bypass the windows driver. > You should be aware that the actual sequence should be supported by the > printer. > Personaly i use these to controll the card movement of Cardprinters like > Zebra and Evolis with Mifare card-readers. > 1. Get 1 from the stack > 2. Move card to the reader > 3. Read/Write Mifare card > 4. Move card back to the start of print position. > Then i close the xbpprinter, and print the text on the card using Express++ > > Some USB printers do not support PCL codes or any plain ACSII strings, > but just accept graphic data, > > Regards, > Jack Duijf > > > > > "Carlos A Beling" <beling@bipbip.com.br> schreef in bericht > news:4061a9f1$4e03f409$49f75@news.alaska-software.com... >> Hello Jack: >> good afternoon. >> Second my understanding, your function is printing using QQOut() and >> QOut() and control chars for any printer, including USB printers. >> Does it really work ok with USB printers? >> >> Beling >> TIA >> >> Jack Duijf escreveu: >>> Hello, >>> >>> As mentioned before, you can use xbpPrinter. >>> The code below works ok for me. >>> The best part is that you do not have to know wich port the printer >>> is assigned. >>> You can even print raw data (escape sequences) as you did in clipper. >>> Make sure you haven the correct printerdriver installed. >>> >>> Regards, >>> Jack Duijf >>> >>> >>> #define XBPPRN_STATUS_PAUSED 0 >>> #define XBPPRN_STATUS_READY 1 >>> #define XBPPRN_STATUS_BUSY (-1) >>> #define XBPPRN_STATUS_SERVICE (-2) >>> #define XBPPRN_STATUS_NOPAPER (-3) >>> #define XBPPRN_STATUS_NOT_READY (-4) >>> #define XBPPRN_STATUS_NA (-5) >>> #define XBPPRN_STATUS_ERROR (-6) >>> #define XBPPRN_STATUS_OFFLINE (-7) >>> >>> Function Test_Printer(cPrinter) >>> LOCAL aList := xbpPrinter():New():List() >>> LOCAL oPrinter := nil >>> LOCAL nStatus := nil >>> LOCAL cMsg := "" >>> if ValType(aList) <> "A" >>> aList := {} >>> endif >>> >>> aList is a list of availeble printers. >>> Now we open the first printer in the list (if none defined in >>> cPrinter): >>> >>> if Len(aList) >0 At least 1 printer is availeble on this machine. >>> Default cPrinter to aList[1] >>> oPrinter := xbpPrinter():New():Create(cPrinter) >>> nStatus := oPrinter:PrinterStatus() >>> cMsg := "" >>> do while nStatus <> XBPPRN_STATUS_READY >>> do case >>> case nStatus = XBPPRN_STATUS_OFFLINE >>> cMsg := "is off line." >>> case nStatus = XBPPRN_STATUS_NOPAPER >>> cMsg := "out of paper." >>> case nStatus = .... See other constants >>> cMsg := "out of paper." >>> otherwise >>> cMsg := "not ready." >>> endcase >>> cMsg :=AllTrim(oPrinter:devname) + CR + cMsg >>> MsgBox(cMsg) >>> nStatus := oPrinter:PrinterStatus() >>> Enddo >>> >>> And now print some raw data as we did in clipper. >>> >>> SET PRINTER TO OBJECT oPrinter >>> SET PRINTER ON >>> SET CONSOLE OFF >>> ?? Chr(27) + Chr(..) + Chr(..) >>> ? "Hello on a printer page"" >>> @ 10,10 say "Any other text" >>> SET CONSOLE ON >>> SET PRINTER OFF >>> SET PRINTER TO >>> >>> endif >>> Return oPrinter >>> |