<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
abdullah-life / laravel-zebra-image-printer example snippets
use AbdullahLife\ZebraImagePrinter\Facades\ZebraPrinter;
// Print local file with 1cm margin
ZebraPrinter::print('/path/to/label.png', 1);
// Print remote URL
ZebraPrinter::print('https://example.com/label.png', 1);
// Print with custom margin
ZebraPrinter::print('/path/to/label.png', 0.5);
// Check if printer is online
if (ZebraPrinter::isOnline()) {
ZebraPrinter::print('/path/to/label.png');
}
use AbdullahLife\ZebraImagePrinter\ZebraPrinter;
class LabelController extends Controller
{
public function print(ZebraPrinter $printer)
{
$printer->print(storage_path('labels/shipping-label.png'), 1);
return response()->json(['status' => 'printed']);
}
}
use AbdullahLife\ZebraImagePrinter\Facades\ZebraPrinter;
// Convert to ZPL without printing
$zpl = ZebraPrinter::convert('/path/to/label.png', 1);
// Send ZPL to different printer
ZebraPrinter::sendToPrinter($zpl, '192.168.1.100', 9100);
// Check specific printer
$isOnline = ZebraPrinter::isOnline('192.168.1.100', 9100);