├── README.md └── src ├── DemoPrintCommands.php ├── DemoPrintCommandsController.php ├── DemoPrintFile.php ├── DemoPrintFileController.php ├── DemoPrintFileDOC.php ├── DemoPrintFileDOCController.php ├── DemoPrintFilePDF.php ├── DemoPrintFilePDFController.php ├── DemoPrintFileTIF.php ├── DemoPrintFileTIFController.php ├── DemoPrintFileWithEncryption.php ├── DemoPrintFileWithEncryptionController.php ├── DemoPrintFileWithPwdProtection.php ├── DemoPrintFileWithPwdProtectionController.php ├── DemoPrintFileXLS.php ├── DemoPrintFileXLSController.php ├── PrintersInfo.php ├── WebClientPrint.php ├── WebClientPrintController.php ├── files ├── GuidingPrinciplesBusinessHR_EN.pdf ├── LoremIpsum-PasswordProtected.doc ├── LoremIpsum-PasswordProtected.pdf ├── LoremIpsum.doc ├── LoremIpsum.pdf ├── LoremIpsum.txt ├── Project-Scheduling-Monitoring-Tool.xls ├── Sample-Employee-Handbook.doc ├── SamplePngImage.png ├── SampleSheet-PasswordProtected.xls ├── SampleSheet.xls ├── mixed-page-orientation.pdf ├── patent2pages.tif └── penguins300dpi.jpg ├── index.php ├── phpseclib ├── Crypt │ ├── AES.php │ ├── Base.php │ ├── Blowfish.php │ ├── DES.php │ ├── Hash.php │ ├── RC2.php │ ├── RC4.php │ ├── RSA.php │ ├── Random.php │ ├── Rijndael.php │ ├── TripleDES.php │ └── Twofish.php ├── File │ ├── ANSI.php │ ├── ASN1.php │ ├── ASN1 │ │ └── Element.php │ └── X509.php └── Math │ └── BigInteger.php ├── samples.php └── template.php /README.md: -------------------------------------------------------------------------------- 1 | # WebClientPrint 6.0 for **PHP** 2 | 3 | ## Overview 4 | [**WebClientPrint 6.0 for PHP**](http://neodynamic.com/products/printing/raw-data/php) is a lightweight and ***plugin-free*** solution for **Client-side Raw Data Printing** scenarios for **Windows**, **Linux**, **Raspberry Pi (Linux ARM)** & **Mac** clients, exclusively designed for **Classic PHP & MVC Frameworks** projects. With the **WebClientPrint solution**, you can easily send raw data, text and native commands as well as known file & document formats to printers installed at the client machine without showing or displaying any print dialog box! 5 | 6 | Learn more about [**WebClientPrint 6.0 for PHP**](http://neodynamic.com/products/printing/raw-data/php/) solution! 7 | 8 | ## About this repo 9 | This PHP project is a sample to getting you started with WebClientPrint 6.0 for PHP Solution 10 | 11 | Website project for **Classic PHP**. If you're using **Laravel**, then please refer to the [**WebClientPrint for PHP Articles**](http://neodynamic.com/products/printing/raw-data/php/articles/) that includes many printing topics with source code. 12 | 13 | ## Know How WebClientPrint 6.0 for PHP Works 14 | Refer to the [Online Help Documentation](http://neodynamic.com/Products/Help/WebClientPrintPHP6.0/index.html) 15 | 16 | ## Licensing 17 | 18 | **WebClientPrint is a Commercial** product. Licensing model and prices are available [here](https://neodynamic.com/products/printing/raw-data/php/buy) 19 | 20 | ## Support 21 | 22 | Tech questions are handled by [Neodynamic Dev Team](https://neodynamic/support) 23 | -------------------------------------------------------------------------------- /src/DemoPrintCommands.php: -------------------------------------------------------------------------------- 1 | 64 | 65 |
18 | With WebClientPrint for PHP solution you can print most common file formats (PDF, TXT, DOC/X, XLS/X, JPG/JPEG, PNG, TIF/TIFF) right to any installed printer at the client side. 19 |
20 | 21 |File Format | 35 |Windows Clients | 36 |Linux, Raspberry Pi & Mac Clients | 37 |
DOC, DOCX | 42 |Microsoft Word is required | 43 |LibreOffice is required | 44 |
XLS, XLSX | 47 |Microsoft Excel is required | 48 |LibreOffice is required | 49 |
Natively supported! | 53 |Natively supported! | 54 ||
TXT | 57 |Natively supported! | 58 |Natively supported! | 59 |
JPEG | 62 |Natively supported! | 63 |Natively supported! | 64 |
PNG | 67 |Natively supported! | 68 |Natively supported! | 69 |
BMP | 72 |Natively supported! | 73 |Natively supported! | 74 |
Printer Support | 77 |You can print files to local installed printers ONLY! Parallel, Serial and IP/Ethernet printers are NOT supported for printing files but for printing raw commands. | 78 |You can print files to any installed printers through CUPS system. | 79 |
96 | The following are pre-selected files to test WebClientPrint File Printing feature. 97 |
98 |47 | With WebClientPrint for PHP solution you can print DOC files right to any installed printer at the client side with advanced settings. 48 |
49 |46 | With WebClientPrint for PHP solution you can print PDF files right to any installed printer at the client side with advanced settings. 47 |
48 | 49 |46 | With WebClientPrint for PHP solution you can print TIF files right to any installed printer at the client side with advanced settings. 47 |
48 | 49 |19 | With WebClientPrint for PHP solution you can print encrypted files in PDF, TXT, JPG/JPEG & PNG formats right to any installed printer at the client side. 20 |
21 | 22 |28 | The following are pre-selected files to test WebClientPrint File Printing with Encryption feature enabled. 29 |
30 |19 | With WebClientPrint for PHP solution you can print password protected PDF, DOC & XLS files right to any installed printer at the client side. 20 |
21 | 22 |
28 | The following are pre-selected files to test WebClientPrint File Printing with Password Protection feature enabled. You can download the files for testing them. The password for all files is ABC123
29 |
47 | With WebClientPrint for PHP solution you can print XLS files right to any installed printer at the client side with advanced settings. 48 |
49 |The following section shows you how to get useful info from the client printers. Please click in the button Get Printers Info below.
41 | 42 |Port Name: | 94 |95 | 96 | | 97 |Horizontal Resolution (dpi): | 98 |99 | 100 | | 101 |Vertical Resolution (dpi): | 102 |103 | 104 | | 105 |
108 | Is Connected?109 | 110 | |
111 |
112 | Is Default?113 | |
114 |
115 | Is BIDI Enabled?116 | |
117 | |||
120 | Is Local?121 | |
122 |
123 | Is Network?124 | |
125 |
126 | 127 | Is Shared? |
128 | |||
131 | Duplex Support?132 | |
133 | 134 | 135 | | 136 |137 | 138 | | 139 |
346 | * echo $des->encrypt(substr($plaintext, 0, 8));
347 | * echo $des->encrypt(substr($plaintext, 8, 8));
348 | *
349 | *
350 | * echo $des->encrypt($plaintext);
351 | *
352 | *
353 | * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates
354 | * another, as demonstrated with the following:
355 | *
356 | *
357 | * $des->encrypt(substr($plaintext, 0, 8));
358 | * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8)));
359 | *
360 | *
361 | * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8)));
362 | *
363 | *
364 | * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different
365 | * outputs. The reason is due to the fact that the initialization vector's change after every encryption /
366 | * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant.
367 | *
368 | * Put another way, when the continuous buffer is enabled, the state of the \phpseclib\Crypt\DES() object changes after each
369 | * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that
370 | * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them),
371 | * however, they are also less intuitive and more likely to cause you problems.
372 | *
373 | * @see \phpseclib\Crypt\Base::enableContinuousBuffer()
374 | * @see self::disableContinuousBuffer()
375 | * @access public
376 | */
377 | function enableContinuousBuffer()
378 | {
379 | parent::enableContinuousBuffer();
380 | if ($this->mode_3cbc) {
381 | $this->des[0]->enableContinuousBuffer();
382 | $this->des[1]->enableContinuousBuffer();
383 | $this->des[2]->enableContinuousBuffer();
384 | }
385 | }
386 |
387 | /**
388 | * Treat consecutive packets as if they are a discontinuous buffer.
389 | *
390 | * The default behavior.
391 | *
392 | * @see \phpseclib\Crypt\Base::disableContinuousBuffer()
393 | * @see self::enableContinuousBuffer()
394 | * @access public
395 | */
396 | function disableContinuousBuffer()
397 | {
398 | parent::disableContinuousBuffer();
399 | if ($this->mode_3cbc) {
400 | $this->des[0]->disableContinuousBuffer();
401 | $this->des[1]->disableContinuousBuffer();
402 | $this->des[2]->disableContinuousBuffer();
403 | }
404 | }
405 |
406 | /**
407 | * Creates the key schedule
408 | *
409 | * @see \phpseclib\Crypt\DES::_setupKey()
410 | * @see \phpseclib\Crypt\Base::_setupKey()
411 | * @access private
412 | */
413 | function _setupKey()
414 | {
415 | switch (true) {
416 | // if $key <= 64bits we configure our internal pure-php cipher engine
417 | // to act as regular [1]DES, not as 3DES. mcrypt.so::tripledes does the same.
418 | case strlen($this->key) <= 8:
419 | $this->des_rounds = 1;
420 | break;
421 |
422 | // otherwise, if $key > 64bits, we configure our engine to work as 3DES.
423 | default:
424 | $this->des_rounds = 3;
425 |
426 | // (only) if 3CBC is used we have, of course, to setup the $des[0-2] keys also separately.
427 | if ($this->mode_3cbc) {
428 | $this->des[0]->_setupKey();
429 | $this->des[1]->_setupKey();
430 | $this->des[2]->_setupKey();
431 |
432 | // because $des[0-2] will, now, do all the work we can return here
433 | // not need unnecessary stress parent::_setupKey() with our, now unused, $key.
434 | return;
435 | }
436 | }
437 | // setup our key
438 | parent::_setupKey();
439 | }
440 |
441 | /**
442 | * Sets the internal crypt engine
443 | *
444 | * @see \phpseclib\Crypt\Base::__construct()
445 | * @see \phpseclib\Crypt\Base::setPreferredEngine()
446 | * @param int $engine
447 | * @access public
448 | * @return int
449 | */
450 | function setPreferredEngine($engine)
451 | {
452 | if ($this->mode_3cbc) {
453 | $this->des[0]->setPreferredEngine($engine);
454 | $this->des[1]->setPreferredEngine($engine);
455 | $this->des[2]->setPreferredEngine($engine);
456 | }
457 |
458 | return parent::setPreferredEngine($engine);
459 | }
460 | }
461 |
--------------------------------------------------------------------------------
/src/phpseclib/File/ANSI.php:
--------------------------------------------------------------------------------
1 |
16 | * @copyright 2012 Jim Wigginton
17 | * @license http://www.opensource.org/licenses/mit-license.html MIT License
18 | * @link http://phpseclib.sourceforge.net
19 | */
20 |
21 | namespace phpseclib\File;
22 |
23 | /**
24 | * Pure-PHP ANSI Decoder
25 | *
26 | * @package ANSI
27 | * @author Jim Wigginton ' . $this->_getScreen() . ''; 550 | } 551 | 552 | /** 553 | * Returns the current screen and the x previous lines 554 | * 555 | * @access public 556 | * @return string 557 | */ 558 | function getHistory() 559 | { 560 | $scrollback = ''; 561 | $last_attr = $this->base_attr_cell; 562 | for ($i = 0; $i < count($this->history); $i++) { 563 | for ($j = 0; $j <= $this->max_x + 1; $j++) { 564 | $cur_attr = $this->history_attrs[$i][$j]; 565 | $scrollback.= $this->_processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : ''); 566 | $last_attr = $this->history_attrs[$i][$j]; 567 | } 568 | $scrollback.= "\r\n"; 569 | } 570 | $base_attr_cell = $this->base_attr_cell; 571 | $this->base_attr_cell = $last_attr; 572 | $scrollback.= $this->_getScreen(); 573 | $this->base_attr_cell = $base_attr_cell; 574 | 575 | return '
' . $scrollback . ''; 576 | } 577 | } 578 | -------------------------------------------------------------------------------- /src/phpseclib/File/ASN1/Element.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 2012 Jim Wigginton 11 | * @license http://www.opensource.org/licenses/mit-license.html MIT License 12 | * @link http://phpseclib.sourceforge.net 13 | */ 14 | 15 | namespace phpseclib\File\ASN1; 16 | 17 | /** 18 | * ASN.1 Element 19 | * 20 | * Bypass normal encoding rules in phpseclib\File\ASN1::encodeDER() 21 | * 22 | * @package ASN1 23 | * @author Jim Wigginton
16 | Send any raw data & commands supported by the client printer like Epson ESC/POS, HP PCL, PostScript, Zebra ZPL and Eltron EPL, and more! 17 |
18 |24 | Print PDF, TXT, DOC, XLS, JPG & PNG images to a client printer without displaying any Print dialog! 25 |
26 |32 | Collect many useful info from all the installed printers in the client machine. 33 |
34 |42 | Print PDF files specifying advanced settings like tray, paper source, print rotation, duplex printing, pages range and more! 43 |
44 |50 | Print DOC files specifying advanced settings like duplex printing, pages range, print in reverse and more! Windows Only 51 |
52 |58 | Print XLS files specifying advanced settings like pages range (From - To) and more! Windows Only 59 |
60 |68 | Print Multipage TIF files specifying advanced settings like tray, paper source, print rotation, duplex printing, pages range and more! 69 |
70 |76 | Encrypt and Print PDF, TXT, JPG & PNG files! 77 |
78 |84 | Print Password Protected PDF, DOC & XLS files! 85 |
86 |