| escpos-php

- Main Page
- Related Pages
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:
[legend]
Collaboration diagram for Mike42\Escpos\PrintConnectors\WindowsPrintConnector:
[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

- local ports on windows (COM1, LPT1, etc)
- shared (SMB) printers from any platform (smb://server/foo) For USB printers or other ports, the trick is to share the printer with a generic text driver, then connect to the shared printer locally.

## 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 | $data | Print data

Exceptions

  Exception |

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

Send job to printer – platform-specific Mac code.

Parameters

  string | $data | Print 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 | $len | Length 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 | $command | the command to run.
  string | $outputStr | variable to fill with standard output.
  string | $errorStr | variable to fill with standard error.
  string | $inputStr | text 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 | $from | Source file
  string | $to | Destination 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 | $data | Data to print
  string | $filename | Destination file

Returns
  boolean True if write was successful, false otherwise

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

Write data to the print connector.

Parameters

  string | $data | The 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:

- C:/www/aplusnet/incahellas.com/public_html/lib/escpos-php-development/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php