QB64 Phoenix Edition
TCP/IP Printing - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Utilities (https://staging.qb64phoenix.com/forumdisplay.php?fid=8)
+---- Thread: TCP/IP Printing (/showthread.php?tid=461)



TCP/IP Printing - AtomicSlaughter - 05-21-2022

Code: (Select All)
Sub TCPPrint (IP As String, Port As String, toPrint As String)
    CRLF$ = Chr$(10) + Chr$(13)
    x = _OpenClient("TCP/IP:" + Port + ":" + IP)
    toPrint = toPrint + CRLF$
    Put #x, , CRFF$
End Sub

Sub TCPEndPrint (IP As String, Port As String)
    CRFF$ = Chr$(10) + Chr$(12)
    x = _OpenClient("TCP/IP:" + Port + ":" + IP)
    Put #x, , CRFF$
End Sub
Utility for Sending raw text to a network printer via TCP/IP

Use the first sub to send the data, then when finished send the second sub and it will initiate the form feed and spit the sheet out.


RE: TCP/IP Printing - CletusSnow - 05-22-2022

Nice thing, but sadly I got only a white sheet. And yes, there's enough ink in the printer. It's a Brother HL-3142CW @ Port 9100.

Edit: OK, I changed line 5 to Put #x,,toPrint. Same effect as before.


RE: TCP/IP Printing - AtomicSlaughter - 05-22-2022

(05-22-2022, 08:21 AM)CletusSnow Wrote: Nice thing, but sadly I got only a white sheet. And yes, there's enough ink in the printer. It's a Brother HL-3142CW @ Port 9100.

Edit: OK, I changed line 5 to Put #x,,toPrint. Same effect as before.

I'm not sure if this is compatible with a laser printer due to the way they print.  The program uses ESC/P codes to print.