Welcome! Log In Create A New Profile

Advanced

[WD 23] Printer port

Posted by infos 
[WD 23] Printer port
November 10, 2022 12:51PM
Hello everyone

I use this code to print text to the POS printer port
// The COM2 port is opened
PortNum = sOpen("COM2", 2000, 2000) // Open COM2
IF PortNum <> 0 THEN
sMessage is string
// Send a message to the output buffer of COM2
sWrite(PortNum, sMessage)
// Wait for the end of the write operation
LOOP
IF sInExitQueue(2) = 0 THEN BREAK
END
Info("End of write operation")
sClose(PortNum)
END

1. How can I get the port name of the printer I choose?
I use the command iInfoPrinter(Printer, iDeviceName) but it always shows me the port of the default printer

2. How can I change the font size of the text that is printed directly on the port?

Thank you

[infosonline.net]
pao
Re: [WD 23] Printer port
November 10, 2022 01:22PM
You are writing directly to the COM2 port and in that case the printer may not even be installed in the OS.
If the printer is not installed on the OS I don't think you can find the name.

To change the font size witing directly in the com port you must check the printer manual to find what is the escape sequence for that.

Regards

Paulo Oliveira
Al
Re: [WD 23] Printer port
November 10, 2022 02:06PM
Hello Infos

iInfoPrinter() only shows the default printer

iListPrinter will give all the printer names
sPrinterList is string
sPrinterList = iListPrinter()


Regards
Al
Re: [WD 23] Printer port
November 10, 2022 02:53PM
I can get a list of printers by name, but I need the port name for the selected printer

[infosonline.net]
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: