5

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

any pointers?

thanks.

p a
  • 51
  • 1
  • 1
  • 2

2 Answers2

12

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.

Community
  • 1
  • 1
Frankie
  • 24,627
  • 10
  • 79
  • 121
0

//[reader path] /t [pdf path][printer]-Print the document with designated printer

exec(" \"$prAddr1\" /t $val  \"$prAddr2\" ");
SwR
  • 612
  • 1
  • 8
  • 21