PHP Class Mike42\Escpos\PrintConnectors\CupsPrintConnector

Inheritance: implements Mike42\Escpos\PrintConnectors\PrintConnector
Datei anzeigen Open project: mike42/escpos-php

Public Methods

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

Protected Methods

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

Private Methods

Method Description
chopLpstatLine ( string $line ) : string Get the item before the first space in a string

Method Details

__construct() public method

Construct new CUPS print connector.
public __construct ( string $dest )
$dest string The CUPS printer name to print to. This must be loaded using a raw driver.

__destruct() public method

Cause a NOTICE if deconstructed before the job was printed.
public __destruct ( )

finalize() public method

Send job to printer.
public finalize ( )

getCmdOutput() protected method

(Basically exec() with good error handling)
protected getCmdOutput ( string $cmd )
$cmd string Command to run

getLocalPrinters() protected method

Load a list of CUPS printers.
protected getLocalPrinters ( ) : array
return array A list of printer names installed on this system. Any item on this list is valid for constructing a printer.

read() public method

Read data from the printer.
public read ( string $len ) : Data
$len string Length of data to read.
return Data read from the printer, or false where reading is not possible.

write() public method

public write ( string $data )
$data string