robgridley / zebra

PHP ZPL builder, image conversion and a basic client for network-connected Zebra label printers.
MIT License
215 stars 54 forks source link

Print two labels #1

Closed sv1gzf closed 8 years ago

sv1gzf commented 8 years ago

Hi I'm trying to print two labels but It only prints the first one !!!!

I used this simple code

use Zebra\Client; use Zebra\Zpl\Image; use Zebra\Zpl\Builder;

$client = new Client('192.168.4.204');

$image = new Image(file_get_contents('voucher.gif'));

$zpl = new Builder(); $zpl->fo(0, 0); $zpl->gf($image); $zpl->fs();

$image = new Image(file_get_contents('receipt.gif'));

$zpl2 = new Builder(); $zpl2->fo(0, 0); $zpl2->gf($image); $zpl2->fs();

$client->send($zpl2); $client->send($zpl);

If I print the labels one by one it works fine

robgridley commented 8 years ago

You're using the same variable name for both images.

You could do this instead:

$zpl->gf(new Image(file_get_contents('receipt.gif')));