Is there a cups PHP API?

Harikrishnan picture Harikrishnan · Oct 3, 2013 · Viewed 7.1k times · Source

I need to make a print on cups printer from my PHP web application. Is there a PHP API for cups? In my server shell_exec() and all such functions are strictly disabled. So I cant print using lpr. Please advice

Answer

Harikrishnan picture Harikrishnan · May 25, 2015

Now it's available. We can do it by PHP::PRINT::IPP
Sample Code

<?php require_once(PrintIPP.php); $ipp = new PrintIPP(); $ipp->setHost("localhost"); $ipp->setPrinterURI("/printers/epson"); $ipp->setData("./testfiles/test-utf8.txt"); // Path to file. $ipp->printJob(); ?>