zebra icon indicating copy to clipboard operation
zebra copied to clipboard

get encoded image without ^XA and ^XZ

Open icyz opened this issue 6 years ago • 2 comments

How can I get only ZPL code without ^XA and ^XZ ? Actually I can trim out those tags, but there is any elegant solution? I've inspected the code but didn't see anything for that.

Thanks

icyz avatar Aug 03 '19 10:08 icyz

One way to do this is with a workaround:

$decoder = GdDecoder::fromPath($imagePath);
$image   = new Image($decoder);

$bytesPerRow = $image->width();
$byteCount   = $bytesPerRow * $image->height();

$zplImage = "^GFA,$byteCount,$byteCount,$bytesPerRow,{$image->toAscii()}";

bsprengelmeijer avatar Aug 30 '22 09:08 bsprengelmeijer