Just bought a new printer Epson XP-4100.
Unbelievable how difficult it is to get the printer you want in Australia due to so many people working from home.
My requirement was for ESC/P support.
Yes, many of the latest Inkjets support ESC/P.
Using it on a Beaglebone Black and didn't want to install CUPS , plus I need to send one line to the printer
and may not send another line for hours untill the page is full.
Previously (Parallel port ) it was just a case of sending the ESC codes and all was sweet.
I thought that using sncNetworkPrinter I could do the same.
However, it simply prints garbage.
Epson advises that unless you load a different driver, the printer defaults to ESC/P.
So I sent chr(27) + chr(64) which is ESC @ to initialize the printer.
Then a Sleep to see what happens, nothing, so press Enter to send next line.
A test line "Hello World"It then loads a new page and prints a few characters of garbage.
Am I being over optimistic to expect this to work this way ?
Or more likely I am completely missing something blatant.
Does anyone have any experience doing this either with joshy's snc or other way.
Regards
EDIT:
echo "Hello World" | nc 192.168.8.107 9100 works ??
But this doesn't
Code: Select all
' [S]imple [N]etwork [C]onnection
#include once "snc.bi"
' test of a printer client connection
const as string ServerIP = "192.168.8.107"
const as ushort ServerPort = 9100
dim as Integer ErrCode
' connect to printer server
var client = NetworkClient(ServerIP,ServerPort)
ErrCode = Client.GetLastError()
If ErrCode <> 0 Then Print GetNetworkErrorText(ErrCode)
' get a connection from ConnectionFactory
var connection = client.GetConnection()
ErrCode = Client.GetLastError()
If ErrCode <> 0 Then Print GetNetworkErrorText(ErrCode)
' ready to send ?
while connection->CanPut()<>1: sleep 100 : wend
ErrCode = Client.GetLastError()
If ErrCode <> 0 Then Print GetNetworkErrorText(ErrCode)
' put data on the connection
Dim as String TxData
Dim as Integer TxLen
TxData = chr(&h1b) + chr(&h40)
TxLen = Len(TxData)
connection->PutData(@TxData,TxLen)
ErrCode = Client.GetLastError()
If ErrCode <> 0 Then Print GetNetworkErrorText(ErrCode)
sleep 100
TxData = "Hello World"
TxLen = Len(TxData)
connection->PutData(@TxData,TxLen)
ErrCode = Client.GetLastError()
If ErrCode <> 0 Then Print GetNetworkErrorText(ErrCode)
end