Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

linux - printing over network from PHP app

I have a set of printers connect over a network with Static IP assigned to each printer.

Now i have a PHP web application running on a linux server which needs to send print jobs, to these printer over the network.

Is this possible using lpr or cups and how do i go about it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could use the LPR Printer class from here:

http://www.phpclasses.org/package/2540-PHP-Abstraction-for-printing-documents.html

Example:

<?php 
include("PrintSend.php");
include("PrintSendLPR.php");

$lpr = new PrintSendLPR(); 
$lpr->setHost("10.0.0.17"); //Put your printer IP here 
$lpr->setData("C:\wampp2\htdocs\print\test.txt"); //Path to file, OR string to print. 

$lpr->printJob("someQueue"); //If your printer has a built-in printserver, it might just accept anything as a queue name.
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...