Connector for sending print jobs to.
More...
|
| __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...
|
|
|
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.
|
|
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.
◆ __construct()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::__construct |
( |
|
$dest | ) |
|
◆ finalizeLinux()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeLinux |
( |
|
$data | ) |
|
|
protected |
Send job to printer – platform-specific Linux code.
- Parameters
-
- Exceptions
-
◆ finalizeMac()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeMac |
( |
|
$data | ) |
|
|
protected |
Send job to printer – platform-specific Mac code.
- Parameters
-
- Exceptions
-
◆ finalizeWin()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::finalizeWin |
( |
|
$data | ) |
|
|
protected |
Send data to printer – platform-specific Windows code.
- Parameters
-
◆ getCurrentPlatform()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::getCurrentPlatform |
( |
| ) |
|
|
protected |
- Returns
- string Current platform. Separated out for testing purposes.
◆ read()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::read |
( |
|
$len | ) |
|
◆ 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 | $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
◆ 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 | $from | Source file |
string | $to | Destination 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 | $data | Data to print |
string | $filename | Destination file |
- Returns
- boolean True if write was successful, false otherwise
◆ write()
Mike42\Escpos\PrintConnectors\WindowsPrintConnector::write |
( |
|
$data | ) |
|
The documentation for this class was generated from the following file:
- src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php