Mike42によって書かれた ESCPOS-php サーマル プリンター ライター ライブラリを Php から Microsoft XPS Writer を使用して XPS ファイルを出力し、レシート用紙を無駄にすることなく印刷レシートをテストしています。
現在のプリンターを「Microsoft XPS Document Writer」に設定し、PHP Web サイトに記載されているライブラリを含めました。
この Web ページ (「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
xps ドキュメント ライターに正しく出力するように ESCPOS-php をセットアップするにはどうすればよいですか? Windows OS を使用しています。特にWindows 7。