2016-12-31 9 views
0

このリンクから(Printing to POS printer from PHP)私はPHPサンプルコードを使い始めました。私の質問は、私のプリンタがデフォルトに設定されている理由、なぜ私はプリンタに接続する必要があります。とにかく私はプリンターを接続する際にエラーが発生しています。 私のプリンタ名はfig1にあり、プリンタにアクセスするためには、図2のように\ Sah-it \ ARP-808Kを実行してください。 私が試してみました:エスコス-phpのプリンタ接続エラー

1.

$connector = new FilePrintConnector("\\Sah-it\ARP-808K"); 
$printer = new Printer($connector); 

2.

$profile = CapabilityProfile::load("simple"); 
$connector = new WindowsPrintConnector("smb://Sah-it/ARP-808Kr"); 
$printer = new Printer($connector, $profile); 

3.

$connector = new NetworkPrintConnector("\\Sah-it\ARP-808K"); 
$printer = new Printer($connector); 

すべては私に接続エラーが発生します。親切に私はプリンタに接続するのに役立ちます。おかげ

FIG1:

enter image description here

FIG2:私は個人的にESC/POS Print Driver for PHPライブラリを使用していませんでしたが、ドキュメントはかなり詳細な方法で使用を述べるい

enter image description here

答えて

0

。画像で判断すると、\\Sah-it\ARP-808Kというサーバーからプリンタを共有しています。

use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; 
    use Mike42\Escpos\CapabilityProfile; 
    $profile = CapabilityProfile::load("simple"); 
    $connector = new WindowsPrintConnector("smb://Sah-it/ARP-808K"); 
    $printer = new Printer($connector, $profile); 

注:ので、あなたのプリンタを確保するためにdocumentationをチェックエプソンTMシリーズのプリンタに適した

をサポートされています(プリンタを推測することはエプソンです)接続するには、あなたが次の操作を行うことをお勧めています

上記のホスト名で問題が発生した場合は、Sah-itを解決できない可能性があるため、PHPサーバのDNS設定を確認してください。この例では、私は、以下のものを使用して、プリンタ(ネットワーク接続されている場合)にしたり、プリントサーバーのIPにIP経由で接続しようとしていることをお勧め:

use Mike42\Escpos\PrintConnectors\NetworkPrintConnector; 
use Mike42\Escpos\Printer; 
$connector = new NetworkPrintConnector("10.x.x.x", 9100); //Printer/Server IP 
$printer = new Printer($connector); 
try { 
    // ... Print stuff 
} finally { 
    $printer -> close(); 
} 

あなたはさらに問題がある場合、あなたのプリンタの製造元とモデルを確認し、追加しますあなたのWebサーバーは\\Sah-itを解決し、関連するエラーを追加することができます。

+0

1. 警告:コピー(\\ Sah-it \ ARP-808K):ストリームのオープンに失敗しました:C:\ wamp \ www \ p \ vendor \ mike42 \ escpos-phpの権限が拒否されました。 \ src \ Mike42 \ Escpos \ PrintConnectors \ WindowsPrintConnector.php on line 372 2. 致命的なエラー:C:\ wamp \ www \ p \ vendor \ mike42の「ファイルをプリンタにコピーできませんでした\エスケープ-php \ src \ Mike42 \ Escpos \ PrintConnectors \ WindowsPrintConnector.php on line 290 3. 例外:C:\ wamp \ www \ p \ vendor \ mike42 \ escpos-php \ srcのファイルをプリンタにコピーできませんでした\ Mike42 \ Escpos \ PrintConnectors \ WindowsPrintConnector.php on line 291 –

+0

この問題をGithubで確認してください:https://github.com/mike42/escpos-php/issues/67 – Kitson88

+0

goeプリンタ接続のデバッグを行います。また、これは明らかにあなたのWAMPサーバーからプリンタへの接続の問題であるように、IPとポート経由で試してみてください。 – Kitson88