Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

print to a network printer using PHP

Tags:

php

printing

lpr

is it possible to print directly to a network printer with PHP using LPR or something similar?

any pointers?

thanks.

like image 748
p a Avatar asked Sep 16 '10 00:09

p a


1 Answers

Sure is. If you are on Linux do use LPR.

exec("lpr -P 'printer' -r 'filename.txt'");

More on LPR commands. Take a look into LPR docs. You can easily show the print-queue and more from PHP.


If you are on Windows use print

exec("print /d:LPT2: C:\filename.txt");

More on print syntax
Or take a look into this guide that has a deeper explanation of command-line printing.

like image 130
Frankie Avatar answered Sep 24 '22 02:09

Frankie