Page 1 of 1

output to printer

Posted: Mon May 20, 2002 12:34 pm
by Gavski
I need to send data to my printer in php and got this code snippet from php site

$handle = printer_open("EPUSB1:Epson stylus 580");
printer_write($handle, "Text to print");
printer_close($handle);

I keep getting error:-undefined function printer_open(), as if php doesn't recognise printer_open();

Any Ideas??

Thanks.

Posted: Mon May 20, 2002 12:43 pm
by fatal
Well my guess was that you have to enable it in the 'php.ini', but the manual doesn't say so. But it did say this:
These functions are only available under Windows 9.x, ME, NT4 and 2000. They have been added in PHP 4 (4.0.4).

http://www.php.net/manual/en/ref.printer.php

mmmm

Posted: Tue May 21, 2002 4:21 am
by Gavski
Yea, I checked my php.ini and printer is enabled I also have v4.12. I'm asuming that if 4.04 has these functions then 4.12 should also, I'm running win Me.

I would have asumed that sending output to a printer is a fairly basic opreation but I can't find much info on it.?
thanks anyway.

printing with php

Posted: Sun Jun 22, 2003 7:13 am
by banks1850
Gavski,
make sure you have the dll in the extensions folder of your php
root folder, if it isn't in there you won't be able to use it even if
you enable php_printer.dll in your php.ini file.

I had that same issue, and this fixed it.

also make sure you are using the right precursor

above the extensions area in your php.ini file there is a entry that looks like this:


; Directory in which the loadable extensions (modules) reside.
extension_dir = ./

if you are using linux or unix for your web server, then this should be ok
but if you are using windows
it should look like this
extension_dir=<path to php/extensions/>

if this was set up incorrectly then you will get an error on starting apache or what ever web server software you use. Just a few things to note, also make sure (I know this sounds obvious but...)you restart the webserver after you change the php.ini file or none of the changes will take effect.