PHP to print using dot-matrix printers

7.2k Views Asked by At

I am working on a project that will end up printing receipts, my client uses a dot-matrix printer (some old version). He will need a system where receipt printing will be fast i.e. time efficient, and not opening a dialog box and choosing a printer...moreover the printer will be shared through a network.

The main problem is that all this should be done using PHP. the following are some thoughts of solutions.

  • Design a php script to write data to a text file then print the text file using a remote printer

-the problem is that I am having a hard time getting server side printing from PHP. Logically it seems to work.

Platform =====> WIN XP

Printer Location =====> Main server on a LAN N/W

2

There are 2 best solutions below

0
On

What's the intended workflow before the user hit's enter?
What's the make and model of printer? This is important so that we can see if it needs any fancy escape codes sent to it?
Usually if you're printing then it would be sent from the client machine.
If printing from the server the data needs to be either sent to the server or needs to already be there and accessible. Is it already there in a database? Or are you sending a webform?
You say RCPT, is this a receipt?

0
On

Okay, so if you have the text file created on the server you should be able to copy the text file to lpt1: or 2: or whatever device it's defined as. You need to know what the file's named as, or you could pass it on, but how about:

exec('c:\WINDOWS\system32\cmd.exe /c START C:\some_dir\print_me.bat');