On Tue, 25 Nov 2003, Burhan Khalid wrote:

> Dale Hersh wrote:
> > I know that in php there are a bunch of basic functions for opening a
> > connection to a printer and then handling the printer queue and so forth. I
> > would like to know how to take a string and echo that to the printer in php.
> 
> The printer functions only work under Windows. From 
> http://www.php.net/printer :
> 
> "These functions are only available under Windows 9.x, ME, NT4 and 2000."
> 
> So if you are on windows, you can try running the printer_write() 
> example ( http://www.php.net/printer-write )
> 
> If you are not on Windows, one way you can print is to try some output 
> redirection and see what kind of results you get, eg :
> 
> system("cat file.txt > lpt1");
> 
> were lpt1 is where your printer is connected. If your printer is 
> connected directly to the computer, it is on lp1 (usually, lpt1 is the 
> default printer port (parallel)). I think lpt1 stands for "line printer 
> terminal 1", but I'm not too sure about that.  There are probably better 
> ways to do the same on other systems, but this is the quick example I 
> could think of.



Hello,

I have printed plenty and regularly under Linux through CUPS by issuing:

exec("lpr -Pprinter_name file_to_print")

or

$ph = popen("lpr -Pprinter_name");
fwrite($ph, $data_to_print);
pclose($ph);


If you need fancy printout, it might be a good idea to produce PDF that is 
printed out, then. If this is what you want, take a look at 
http://dataxi.sourceforge.net and download solib-version.tar.gz that 
contains sopdf.php -- or dataxi-version.tar.gz for higher level PDF 
classes. You need www.pdflib.com (free lite version available) in order 
to use sopdf.php or it's derivants.

Cheers,

-- 
--Jyry
:-(    C:-/    C========8-O    C8-/    C:-(

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to