Jump to content

Recommended Posts

Posted

Hi All,

 

Does anyone know a way to print directly to a printer using PHP? So far I've been using javascript:

window.print()

Which does print what I want it to but displays the print dialog box.

 

I'd like it to go straight to either the client default printer or to a printer attached to the webserver.

 

Thanks,

 

Dan

Posted

Hi All,

 

After some playing around with PHP and Shell I've used the following method that works quite well. I thought I'd post it on here for others if they ever needed it.

 

shell_exec('lpr -P $Printer $file');

 

Which basically prints $file to $printer (that is a printer installed on the server.)

 

Dan

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...