escpos-php
Public Member Functions | Protected Member Functions | List of all members
Mike42\Escpos\PrintConnectors\CupsPrintConnector Class Reference

Print connector that passes print data to CUPS print commands. More...

Inheritance diagram for Mike42\Escpos\PrintConnectors\CupsPrintConnector:
Inheritance graph
[legend]
Collaboration diagram for Mike42\Escpos\PrintConnectors\CupsPrintConnector:
Collaboration graph
[legend]

Public Member Functions

 __construct ($dest)
 Construct new CUPS print connector. More...
 
 __destruct ()
 Cause a NOTICE if deconstructed before the job was printed.
 
 finalize ()
 Send job to printer.
 
 read ($len)
 Read data from the printer. More...
 
 write ($data)
 

Protected Member Functions

 getCmdOutput ($cmd)
 Run a command and throw an exception if it fails, or return the output if it works. More...
 
 getLocalPrinters ()
 Load a list of CUPS printers. More...
 

Detailed Description

Print connector that passes print data to CUPS print commands.

Your printer mut be installed on the local CUPS instance to use this connector.

Constructor & Destructor Documentation

◆ __construct()

Mike42\Escpos\PrintConnectors\CupsPrintConnector::__construct (   $dest)

Construct new CUPS print connector.

Parameters
string$destThe CUPS printer name to print to. This must be loaded using a raw driver.
Exceptions
BadMethodCallException

Member Function Documentation

◆ getCmdOutput()

Mike42\Escpos\PrintConnectors\CupsPrintConnector::getCmdOutput (   $cmd)
protected

Run a command and throw an exception if it fails, or return the output if it works.

(Basically exec() with good error handling)

Parameters
string$cmdCommand to run

◆ getLocalPrinters()

Mike42\Escpos\PrintConnectors\CupsPrintConnector::getLocalPrinters ( )
protected

Load a list of CUPS printers.

Returns
array A list of printer names installed on this system. Any item on this list is valid for constructing a printer.

◆ read()

Mike42\Escpos\PrintConnectors\CupsPrintConnector::read (   $len)

Read data from the printer.

Parameters
string$lenLength of data to read.
Returns
string Data read from the printer, or false where reading is not possible.

Implements Mike42\Escpos\PrintConnectors\PrintConnector.

◆ write()

Mike42\Escpos\PrintConnectors\CupsPrintConnector::write (   $data)
Parameters
string$data

Implements Mike42\Escpos\PrintConnectors\PrintConnector.


The documentation for this class was generated from the following file: