Subject | Re: [firebird-php] OT - send escape character to printer directly through IE |
---|---|
Author | Milan Babuskov |
Post date | 2005-12-06T17:41:20Z |
Almond wrote:
I solved this by creating the print file on the server, and printing
throught network directly (not through browser). For example, if you
name the file "file.txt", you would do it like this:
On Windows-to-Windows combination you can use a call like:
system('copy /b file.txt > \\computer\printer_name');
If you have Linux-to-Windows situation, you can use smbclient:
system(
"smbclient '\\computer\printer_name' -N -c \"print file.txt\" -P");
Watch for wrap, it's a single line command.
For Linux-to-Linux, you can use lpr command:
system("lpr -l -Pprintername file.txt");
Make sure you don't just use "file.txt", but rather a full path to the
file, as the executed command might not run in the same directory as PHP.
If you do this in a multiuser environment, you might also want to use
multiple files, so everyone gets his own document printed. I used a
Firebird's generator for this, to generate unique filenames: 1.txt,
2.txt, 3.txt, etc.
Summary: it isn't OT after all.
P.S. Next time you start a conversation, please do not hijack other
threads by hitting reply and deleting everything. It looks ugly in most
e-mail clients. Just write a new message from scratch.
--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org
> Anybody know how to send a file with escape codes through IE to aHi,
> printer. I found that any escape codes are lost if the file is
> processed through IE.
>
> I create a file contain some escape codes for dot matrix printer. If I
> download the file and output to printer, there is no problem. But if I
> using right click and select print, the escape codes are lost.
>
> I only succeeded with an activeX control which download the file and
> then copy it to the printer. Is there another way to make it work ?
> Since the aciveX control is not stable.
I solved this by creating the print file on the server, and printing
throught network directly (not through browser). For example, if you
name the file "file.txt", you would do it like this:
On Windows-to-Windows combination you can use a call like:
system('copy /b file.txt > \\computer\printer_name');
If you have Linux-to-Windows situation, you can use smbclient:
system(
"smbclient '\\computer\printer_name' -N -c \"print file.txt\" -P");
Watch for wrap, it's a single line command.
For Linux-to-Linux, you can use lpr command:
system("lpr -l -Pprintername file.txt");
Make sure you don't just use "file.txt", but rather a full path to the
file, as the executed command might not run in the same directory as PHP.
If you do this in a multiuser environment, you might also want to use
multiple files, so everyone gets his own document printed. I used a
Firebird's generator for this, to generate unique filenames: 1.txt,
2.txt, 3.txt, etc.
Summary: it isn't OT after all.
P.S. Next time you start a conversation, please do not hijack other
threads by hitting reply and deleting everything. It looks ugly in most
e-mail clients. Just write a new message from scratch.
--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org