I am trying to output an XPS file using the Microsoft XPS Writer from Php with the ESCPOS-php thermal printer writer library found here, written by Mike42, to test print receipts without wasting receipt paper.
I have set the current Printer to "Microsoft XPS Document Writer", and have included the library mentioned in my php website.
I tried printing this webpage (named 'p1PrinterSolution')
function letsPrint()
{
require_once(dirname(__FILE__) . "/escpos-php-master/Escpos.php");
$connector = new FilePrintConnector("Microsoft XPS Document Writer");
$printer = new Escpos($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
$printer -> close();
}
#let's call the function now kid!
letsPrint();
However, I am receving this error:
Fatal error: Call to undefined function gzdecode() in (the location of escpos-php) on line 173
If I try to call $printer = new Escpos();
without declaring a connector, I am greeted with this error:
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Argument passed to Escpos::__construct() must implement interface PrintConnector, null given.' in (path)\escpos-php-master\Escpos.php:176 Stack trace: #0 (path)\p1PrinterSolution.php(62): Escpos->__construct() #1 {main} thrown in (path)\escpos-php-master\Escpos.php on line 176
How can I setup the ESCPOS-php to print to xps document writer correctly? I am using a windows OS. Windows 7 in particular.