QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: JohnUKresults on July 19, 2020, 11:44:20 am
-
Hi.
Anyone had any success printing to Zebra or similar thermal printers from QB64?
I know you can't use printer control codes as in the "olden days of escape characters", but I just want to print some plain text and don't want to spend the best part of £300 on a printer only to find I can't do it!
It's just to do quick printouts for people at race events, to confirm finish times and positions etc, so no fancy graphics required.
Thanks for any tips.
John
-
@JohnUKresults The Printronix SDK can work with any printer. You can send ZPL/ZGL commands to a printer. Let me dig up my code for Printronix printers and you can have it. All you need is the openport() and sendcommand() functions. Download the attached DLL to use it. I can't remember if you need to terminate the printer name and command with CHR$(0). Do some tests. It works with both networked and local printers. Alternatively, if your printer is simply just networked, just open a TCP/IP client in QB64 on port 9100 (the printing port) and send your raw data.
PRINT DLLinit
'initialize the DLL PRINT openport
("whatever you printer is named as it appears in Devices/Printers in Control Panel") PRINT sendcommand
("whatever the string is for the code of your label") PRINT closeport
'close the port PRINT DLLexit
'exit the DLL
-
@JohnUKresults The Printronix SDK can work with any printer. You can send ZPL/ZGL commands to a printer. Let me dig up my code for Printronix printers and you can have it. All you need is the openport() and sendcommand() functions. Download the attached DLL to use it. I can't remember if you need to terminate the printer name and command with CHR$(0). Do some tests. It works with both networked and local printers. Alternatively, if your printer is simply just networked, just open a TCP/IP client in QB64 on port 9100 (the printing port) and send your raw data.
PRINT DLLinit
'initialize the DLL PRINT openport
("whatever you printer is named as it appears in Devices/Printers in Control Panel") PRINT sendcommand
("whatever the string is for the code of your label") PRINT closeport
'close the port PRINT DLLexit
'exit the DLL
Hi SpriggsySpriggs!!.
This dll would also work to print on matrix printers, with Esc codes?
-
@Juanjogomez I've not tried it with matrix printers but I know the escape codes work on label printers such as form feed. I would imagine they would work on the matrix printers as well.
-
Hi
Thanks - will have a close look at that code to see how it works. I will be connecting via usb in all probability but networking could be a secondary option I suppose.
Would this also enable escape codes to be used on other printers too?
I have had to make changes to an old QB4.5 program ported to QB64, which output via LPT to parallel printers by making them print out to rtf documents instead of directly to the printers as previously, because I couldnt use the escape codes directly in QB64 according to the Lprint information.
Grateful for your responses.
John
-
Hi
Thanks - will have a close look at that code to see how it works. I will be connecting via usb in all probability but networking could be a secondary option I suppose.
Would this also enable escape codes to be used on other printers too?
I have had to make changes to an old QB4.5 program ported to QB64, which output via LPT to parallel printers by making them print out to rtf documents instead of directly to the printers as previously, because I couldnt use the escape codes directly in QB64 according to the Lprint information.
Grateful for your responses.
John
@JohnUKresults You should be able to use the ESCAPE characters by just sending them like CHR$(12) for formfeed and whatnot. It should work, as long as you are able to send the string correctly.