Printing on DOT MATRIX

Hi Guys,

Anybody know how to use xojo to print on a line printer like epson dot matrix printer?

Kindly please share.

It should just work. What have you tried? What did it do vs. what you expected?

Thanks Tim,

But printing to a dot matrix is very different compared to printing with usual ink jet printer.

Generating reports designed for Dot Matrix print faster because it uses the native printer fonts not windows fonts.

How to do it with xojo?

You draw to the graphics object returned from OpenPrinter (DrawString, etc) and the system will handle the translation to the printer for you. Again, have you tried it?

Yes I tried to create a report in xojo and print it in dot matrix. Its slow maybe because it use windows fonts?

What I wanted to do is to use the native epson printer fonts together with the ESC acii command to printer.

A normal windows printer driver prints a picture of the graphic.

What the OP wants is lterally to send chr(65) and get ‘A’ coming out.
Blisteringly fast but limited in design style.

HP Laserjet printers recognise the use of standard fonts like Arial and substitute those with built in printer fonts.

To get the maximum speed out of a DM printer, you need to send ASCII characters to the LPT1: device.
Codes like chr(12) do special tasks such as page feeds.
Chr(27) follewed by another code sets up special settings.

http://www.lprng.com/DISTRIB/RESOURCES/PPD/epson.htm

Im assuming you are on Windows?

see this post for clues:
http://forums.realsoftware.com/viewtopic.php?f=1&t=36609

Hi Jeff,

So this was it!

"
Serial1.SerialPort = System.SerialPort(“LPT1”)
serial1.reset
serial1.close
if Serial1.Open then
put here you esc code
End if
"
Now I know. Thanks!!!

[quote=212049:@ronaldo florendo]Yes I tried to create a report in xojo and print it in dot matrix. Its slow maybe because it use windows fonts?

What I wanted to do is to use the native epson printer fonts together with the ESC acii command to printer.[/quote]

You need to communicate with the printer through serial. I have not done that in twenty years but what I remember from the time I supplied fonts for them, it usually was 9600 bauds, odd, 1 bit parity. You want to download the original manual here :
http://www.epson.com/cgi-bin/Store/support/supDetail.jsp?infoType=Doc&oid=14285

It has all the ESC codes and protocol handling.

I see that Jeff already told you a lot. You can indeed do most of that through shell.

Thanks Michel.

I loved your reply.

Hi guys,

Just got back to this concern.

I cannot make this things works.

BAUD: 9600
BIT: 1 stop bit
PARTITY: ODD

[code]Serial1.SerialPort = System.SerialPort(“USB002”)
serial1.reset
serial1.close
if Serial1.Open then

msgbox("Open!")

else
msgbox(“not working!”)

End if
Serial1.Close[/code]

I really appreciate your help.

my dot matrix printer is sitting next to my rotary dial telephone and betamax video recorder, with my 33 1/3 rpm phonograph

multipart forms really need an impact printer of some kind
they still exist (lots of government forms are this way - I have a pile sitting right here for the Govt of Canada)

Try create a TXT file and sending to printer, like:

[code]
Dim f As FolderItem= GetTemporaryFolderItem
Dim tOut As TextOutputStream= TextOutputStream.Create(f)

tOut.WriteLine(ConvertEncoding(“Some text with ESC codes…”, Encodings.DOSLatin1))

tOut.Close

Dim Device As String

Dim s As New Shell
s.Mode= 1 // async
#If TargetWin32
If Device<> “” Then tDevice= " /D:"+ Device
s.Execute "print “+ f.NativePath+ tDevice
#Else
If Device<> “” Then tDevice= " -d”+ Device
s.Execute "lp "+ f.NativePath+ tDevice
#EndIf[/code]

Device is a String with “LPT2” or “COM1”. Look for “print” or “lp” command for your SO.

Is this a USB dot matrix printer ?

yes.

im using epson lx300 ii printer which was usb cable.

Hi Bernardo,

My Dot matrix printer does not show LPT or COM. It was installed via Virtual Port assigned by Windows (USB002).

Any idea?

Try with Device variable set to “USB002”, use command prompt first:

c:/>print somefile.txt /D: USB002

I have used the printer spooler API in the past to print direct/raw (escape sequences) to a usb dot-matrix printer. Check MSDN for

OpenPrinter
StartDocPrinter
StartPagePrinter
WritePrinter
etc.

Hi Bernardo, you solution does not work. I also read an article that dos command work only on LTP and COM (serial).

Hi, Tim

Thanks for the share of idea. It is more helpful if somebody can offer complete code for that OpenPrinter. Since that functionality is witihin c++ script.

Im a begginner.

please help.

USB is “serial” only in that it sends data one byte after the other

The Serial control is for Serial ports RS232 or ones that are faked out by a driver that presents a usb dongle as an RS232 port

I dont know if your virtual port is set up like https://en.wikipedia.org/wiki/COM_port_redirector
IF it is possible to set up a virtual com port that redirects to your USB printer then the serial control might work

OpenPrinter might show the printer, if Windows things its a “Printer” selectable in one of its printer dialogs, BUT that wont let you send ascii style character data to it like you want
It basically tries to send a graphic to the printer - which your printer wont handle