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

Connector for sending print jobs to. More...

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

Public Member Functions

 __construct ($dest)
 
 __destruct ()
 Print connectors should cause a NOTICE if they are deconstructed when they have not been finalized.
 
 finalize ()
 Finish using this print connector (close file, socket, send accumulated output, etc).
 
 read ($len)
 Read data from the printer. More...
 
 write ($data)
 Write data to the print connector. More...
 

Public Attributes

const PLATFORM_LINUX = 0
 Represents Linux.
 
const PLATFORM_MAC = 1
 Represents Mac.
 
const PLATFORM_WIN = 2
 Represents Windows.
 
const REGEX_LOCAL = "/^(LPT\d|COM\d)$/"
 Valid local ports.
 
const REGEX_PRINTERNAME = "/^[\d\w-]+(\s[\d\w-]+)*$/"
 Valid printer name.
 
const REGEX_SMB = "/^smb:\/\/([\s\d\w-]+(:[\s\d\w+-]+)?@)?([\d\w-]+\.)*[\d\w-]+\/([\d\w-]+\/)?[\d\w-]+(\s[\d\w-]+)*$/"
 Valid smb:// URI containing hostname & printer with optional user & optional password only.
 

Protected Member Functions

 finalizeLinux ($data)
 Send job to printer – platform-specific Linux code. More...
 
 finalizeMac ($data)
 Send job to printer – platform-specific Mac code. More...
 
 finalizeWin ($data)
 Send data to printer – platform-specific Windows code. More...
 
 getCurrentPlatform ()
 
 runCommand ($command, &$outputStr, &$errorStr, $inputStr=null)
 Run a command, pass it data, and retrieve its return value, standard output, and standard error. More...
 
 runCopy ($from, $to)
 Copy a file. More...
 
 runWrite ($data, $filename)
 Write data to a file. More...
 

Detailed Description

Connector for sending print jobs to.

Constructor & Destructor Documentation

◆ __construct()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::__construct (   $dest)
Parameters
string$dest
Exceptions
BadMethodCallException

Member Function Documentation

◆ finalizeLinux()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeLinux (   $data)
protected

Send job to printer – platform-specific Linux code.

Parameters
string$dataPrint data
Exceptions
Exception

◆ finalizeMac()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeMac (   $data)
protected

Send job to printer – platform-specific Mac code.

Parameters
string$dataPrint data
Exceptions
Exception

◆ finalizeWin()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeWin (   $data)
protected

Send data to printer – platform-specific Windows code.

Parameters
string$data

◆ getCurrentPlatform()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::getCurrentPlatform ( )
protected
Returns
string Current platform. Separated out for testing purposes.

◆ read()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::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.

◆ runCommand()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::runCommand (   $command,
$outputStr,
$errorStr,
  $inputStr = null 
)
protected

Run a command, pass it data, and retrieve its return value, standard output, and standard error.

Parameters
string$commandthe command to run.
string$outputStrvariable to fill with standard output.
string$errorStrvariable to fill with standard error.
string$inputStrtext to pass to the command's standard input (optional).
Returns
number

◆ runCopy()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::runCopy (   $from,
  $to 
)
protected

Copy a file.

Separated out so that nothing is actually printed during test runs.

Parameters
string$fromSource file
string$toDestination file
Returns
boolean True if copy was successful, false otherwise

◆ runWrite()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::runWrite (   $data,
  $filename 
)
protected

Write data to a file.

Separated out so that nothing is actually printed during test runs.

Parameters
string$dataData to print
string$filenameDestination file
Returns
boolean True if write was successful, false otherwise

◆ write()

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::write (   $data)

Write data to the print connector.

Parameters
string$dataThe data to write

Implements Mike42\Escpos\PrintConnectors\PrintConnector.


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