Esempio n. 1
0
 /**
  * Check if printing is enabled
  *
  * @return boolean
  */
 public function canPrintFunction()
 {
     $host = $this->printHost;
     $queue = $this->printQueue;
     if (null !== $host && null !== $queue) {
         try {
             $ipp = new CupsPrintIPP();
             $ipp->setLog('', 0, 0);
             $ipp->setHost($host);
             $ipp->setPrinterURI($queue);
             $ipp->getPrinterAttributes();
             return implode('\\n', $ipp->status) == 'successfull-ok';
         } catch (IPPException $e) {
         }
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Check if printer is available
  *
  * @return boolean
  */
 protected function canPrint()
 {
     $host = $this->container->getParameter('print_host', null);
     $queue = $this->container->getParameter('print_queue', null);
     if (null !== $host && null !== $queue) {
         try {
             $ipp = new CupsPrintIPP();
             $ipp->setLog('', 0, 0);
             $ipp->setHost($host);
             $ipp->setPrinterURI($queue);
             $ipp->getPrinterAttributes();
             return implode('\\n', $ipp->status) == 'successfull-ok';
         } catch (IPPException $e) {
         }
     }
     return false;
 }