Я пытаюсь вывести файл XPS с помощью Microsoft XPS Writer из Php с найденной библиотекой записи термопринтера ESCPOS-php здесь, написанный Mike42, чтобы проверить распечатку квитанций без траты бумаги для квитанций.
Я установил текущий принтер на «Microsoft XPS Document Writer» и включил библиотеку, упомянутую на моем веб-сайте php.
Я попытался распечатать эту веб-страницу (названную '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();
Однако я получаю эту ошибку:
Fatal error: Call to undefined function gzdecode() in (the location of escpos-php) on line 173
Если я попытаюсь вызвать $printer = new Escpos();
, не объявляя соединитель, я получаю следующую ошибку:
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
Как я могу настроить ESCPOS-php для правильной печати в xps document writer? Я использую ОС Windows. В частности, Windows 7.