开发者

Printing to Dot Matrix printers from Web Apps

开发者 https://www.devze.com 2023-01-09 04:01 出处:网络
I am not familiar with Dot Matrix printers but I have a customer with a WebApp that generates invoices, print checks, etc.. Currently they are printing directly from the server, meaning that the print

I am not familiar with Dot Matrix printers but I have a customer with a WebApp that generates invoices, print checks, etc.. Currently they are printing directly from the server, meaning that the printer must be connected to the server or that the server needs a way to connect to the remote printer. As you can imagine this generates a lot of problems.

My first reaction was, generate a pdf doc. on the server and send it to the client so they can print it on whichever printer they have access to. But it turns out that many of his customers us开发者_运维技巧e dot matrix printers which do not support printing of PDF.

My question, is there any file format that all dot matrix printers can read? HTML, ASCII, etc... My customer insists that the only way to go is to have the server print directly from php which seems extremely odd to me.

Thank you in advance!


I see that though this question is posted quite some back and already solution is selected but some how i feel that the problem is very genuine and still many may be wanting a solution to this as more and more web apps are coming up so hope some may find this solution beneficial.

Printing graphics on the Dotmatrix printer is a very slow as compared to printing plain ascii text.

An invoice which may be printed in less then a minute on a dotmatrix printer can take upto 8-10 minutes to be printed in graphics mode so time is a issue for printing graphics on dotmatrix also apart from time it would mean more wear and tear of the printer head and ribbon and since normally dotmatrix printer is these days primarily used for business applications emphasis is not on quality of print but the data to be printed on paper.

Solution

You can build an executable or a process which is running in memory monitoring a folder which can act as a drop box. (As soon as a file is present in this folder this execuable would send this file to printer.)

for eg if the drop folder path is c:\printoutput

and a file is placed in this as invoice.txt all that the execuable file/print process has to do is send a dos/shell command as

c:\type c:\printoutput\invoice.txt > lpt1 (you can replace lpt1 with prn or any local port where printer is connected)

Web application can simply save the text file to the folder c:\printoutput

The executable file may have constant monitoring / run after specific time span / hotkey to invoke printing as soon as user knows he had put some file in the printfolder to be printed.

Also you can still use Epson ESC codes to use dotmatrix internal font selection or formatting etc by embedding it in the text file.

So you may have absolutely the same formatted print as from the printer connected on the local port of the server.


many of his customers use dot matrix printers which do not support printing of PDF

Nonsense - it's nothing to do with the printer - it's the printer driver which determines whether its capable. Most of the printers I use don't speak PDF (or postscript, or MSWord, or OpenOffice.....) but I can still print my documents on them. 25 years ago I could print graphics on 7 pin Paper Tigers (although I admit I'd have trouble finding a printer driver for one today). Do have a look at ghostscript. Most DMPs built in the last 10 years support Epson ESC/P2 emulation.

Alternatively you could use a text browser to create ascii from your html (e.g. lynx).

Hardly seems worth the effort to convert the text to PDF then back agains before printing - but ghostscript can be configured to use an ascii output device. So you can even print PDFs on daisywheel printers!

C.


Every printer should be able to print a plain ASCII file.

0

精彩评论

暂无评论...
验证码 换一张
取 消