escpos-php
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Mike42\Escpos\PrintConnectors\WindowsPrintConnector Class Reference
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 ()
 
 finalize ()
 
 read ($len)
 
 write ($data)
 

Public Attributes

const PLATFORM_LINUX = 0
 
const PLATFORM_MAC = 1
 
const PLATFORM_WIN = 2
 
const REGEX_LOCAL = "/^(LPT\d|COM\d)$/"
 
const REGEX_PRINTERNAME = "/^[\d\w-]+(\s[\d\w-]+)*$/"
 
const REGEX_SMB = "/^smb:\/\/([\s\d\w-]+(:[\s\d\w+-]+)?@)?([\d\w-]+\.)*[\d\w-]+\/([\d\w-]+\/)?[\d\w-]+(\s[\d\w-]+)*$/"
 

Protected Member Functions

 finalizeLinux ($data)
 
 finalizeMac ($data)
 
 finalizeWin ($data)
 
 getCurrentPlatform ()
 
 runCommand ($command, &$outputStr, &$errorStr, $inputStr=null)
 
 runCopy ($from, $to)
 
 runWrite ($data, $filename)
 

Detailed Description

Connector for sending print jobs to

Constructor & Destructor Documentation

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

Print connectors should cause a NOTICE if they are deconstructed when they have not been finalized.

Implements Mike42\Escpos\PrintConnectors\PrintConnector.

Member Function Documentation

Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalize ( )

Finish using this print connector (close file, socket, send accumulated output, etc).

Implements Mike42\Escpos\PrintConnectors\PrintConnector.

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

Send job to printer – platform-specific Linux code.

Parameters
string$dataPrint data
Exceptions
Exception
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeMac (   $data)
protected

Send job to printer – platform-specific Mac code.

Parameters
string$dataPrint data
Exceptions
Exception
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeWin (   $data)
protected

Send data to printer – platform-specific Windows code.

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

Read data from the printer.

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

Implements Mike42\Escpos\PrintConnectors\PrintConnector.

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
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
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
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::write (   $data)

Write data to the print connector.

Parameters
string$dataThe data to write

Implements Mike42\Escpos\PrintConnectors\PrintConnector.

Member Data Documentation

const Mike42\Escpos\PrintConnectors\WindowsPrintConnector::PLATFORM_LINUX = 0

Represents Linux

const Mike42\Escpos\PrintConnectors\WindowsPrintConnector::PLATFORM_MAC = 1

Represents Mac

const Mike42\Escpos\PrintConnectors\WindowsPrintConnector::PLATFORM_WIN = 2

Represents Windows

const Mike42\Escpos\PrintConnectors\WindowsPrintConnector::REGEX_LOCAL = "/^(LPT\d|COM\d)$/"

Valid local ports.

const Mike42\Escpos\PrintConnectors\WindowsPrintConnector::REGEX_PRINTERNAME = "/^[\d\w-]+(\s[\d\w-]+)*$/"

Valid printer name.

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


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