PHP Class Mike42\Escpos\PrintConnectors\WindowsPrintConnector

Copyright (c) 2014-2015 Michael Billington , incorporating modifications by: - Roni Saha - Gergely Radics - Warren Doyle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Connector for sending print jobs to - local ports on windows (COM1, LPT1, etc) - shared (SMB) printers from any platform (\\server\foo) For USB printers or other ports, the trick is to share the printer with a generic text driver, then access it locally.
Inheritance: implements Mike42\Escpos\PrintConnectors\PrintConnector
Mostrar archivo Open project: mike42/escpos-php

Public Methods

Method Description
__construct ( string $dest )
__destruct ( )
finalize ( )
read ( $len ) * (non-PHPdoc)
write ( $data )

Protected Methods

Method Description
finalizeLinux ( string $data ) Send job to printer -- platform-specific Linux code.
finalizeMac ( string $data ) Send job to printer -- platform-specific Mac code.
finalizeWin ( string $data ) Send data to printer -- platform-specific Windows code.
getCurrentPlatform ( ) : string
runCommand ( string $command, string &$outputStr, string &$errorStr, string $inputStr = null ) : number Run a command, pass it data, and retrieve its return value, standard output, and standard error.
runCopy ( string $from, string $to ) : boolean Copy a file. Separated out so that nothing is actually printed during test runs.
runWrite ( string $data, string $to ) : boolean Write data to a file. Separated out so that nothing is actually printed during test runs.

Method Details

__construct() public method

public __construct ( string $dest )
$dest string

__destruct() public method

public __destruct ( )

finalize() public method

public finalize ( )

finalizeLinux() protected method

Send job to printer -- platform-specific Linux code.
protected finalizeLinux ( string $data )
$data string Print data

finalizeMac() protected method

Send job to printer -- platform-specific Mac code.
protected finalizeMac ( string $data )
$data string Print data

finalizeWin() protected method

Send data to printer -- platform-specific Windows code.
protected finalizeWin ( string $data )
$data string

getCurrentPlatform() protected method

protected getCurrentPlatform ( ) : string
return string Current platform. Separated out for testing purposes.

read() public method

* (non-PHPdoc)
See also: PrintConnector::read()
public read ( $len )

runCommand() protected method

Run a command, pass it data, and retrieve its return value, standard output, and standard error.
protected runCommand ( string $command, string &$outputStr, string &$errorStr, string $inputStr = null ) : number
$command string the command to run.
$outputStr string variable to fill with standard output.
$errorStr string variable to fill with standard error.
$inputStr string text to pass to the command's standard input (optional).
return number

runCopy() protected method

Copy a file. Separated out so that nothing is actually printed during test runs.
protected runCopy ( string $from, string $to ) : boolean
$from string Source file
$to string Destination file
return boolean True if copy was successful, false otherwise

runWrite() protected method

Write data to a file. Separated out so that nothing is actually printed during test runs.
protected runWrite ( string $data, string $to ) : boolean
$data string Data to print
$to string Destination file
return boolean True if write was successful, false otherwise

write() public method

public write ( $data )