Examples
The ZPL of each example, and the SVG that the package renders from it.
^XA
^CI28
^PW812
^LL1218
^FX Sender
^CF0,28
^FO50,50^FDNorthvale Logistics Inc.^FS
^CF0,22
^FO50,85^FD4 Harbor Street^FS
^FO50,112^FDPortland, OR 97209^FS
^FX Divider
^FO50,150^GB712,3,3^FS
^FX Recipient
^CF0,26
^FO50,175^FDShip to^FS
^CF0,44
^FO50,210^FDBrookside Builders LLC^FS
^CF0,36
^FO50,265^FD18 Marsh Road^FS
^FO50,310^FDDenver, CO 80202^FS
^FO50,355^FDUnited States^FS
^FX Service box
^FO50,420^GB712,120,3^FS
^FO50,420^GB712,50,50^FS
^FO65,432^FR^CF0,30^FDParcel - Business^FS
^CF0,28
^FO65,485^FDWeight: 27.3 lb^FS
^FO420,485^FDPieces: 1 / 2^FS
^FX Sorting code
^FO50,570^A0N,90,90^FDCO-74^FS
^FO500,570^BQN,2,6^FDQA,https://example.com/track/00357000000000001234^FS
^FX Route barcode
^BY3,3,110
^FO50,720^BCN,110,Y,N,N^FD>;00357000000000001234^FS
^FX Footer
^FO50,900^GB712,3,3^FS
^CF0,24
^FO50,925^FB712,3,4,L,0^FDDelivered on weekdays from 8 am to 4 pm. Contact customer service if the parcel has not arrived within five business days.^FS
^FO50,1040^A0N,24,24^FDRef: ORD-2026-00918^FS
^FO50,1080^GB300,60,2^FS
^FO70,1095^A0N,30,30^FDINV 44812^FS
^FT400,1080^A0R,28,28^FDVertical^FS
^XZUsage
composer require stilling/zpl-rendereruse Stilling\ZplRenderer\Options;
use Stilling\ZplRenderer\ZplRenderer;
$zpl = '^XA^FO50,50^A0N,40,40^FDHello^FS^FO50,120^BCN,80,Y,N,N^FD12345678^FS^XZ';
$options = new Options(dpmm: 8, widthMm: 101.6, heightMm: 152.4);
file_put_contents('label.pdf', ZplRenderer::toPdf($zpl, $options));
file_put_contents('label.svg', ZplRenderer::toSvg($zpl, $options));
file_put_contents('label.png', ZplRenderer::toPng($zpl, $options));The package also installs a zpl command:
vendor/bin/zpl label.zpl pdf
vendor/bin/zpl label.zpl png --scale=2
cat label.zpl | vendor/bin/zpl - svg > label.svgCoverage
- More than 20 barcode types: Code 128, Code 39, EAN and UPC, GS1 DataBar, QR Code, Data Matrix, PDF417, Aztec and more.
- Boxes, circles, ellipses, diagonal lines, reverse print, and images from
^GF,~DGand~DY. - Stored formats with
^DFand^XF, and field variables and serial numbers. - The scalable font 0 and the bitmap fonts A to H, at the size and pitch of the printer.
- Configurable limits on label size, graphics, pages and image pixels, for ZPL that you do not control.
