mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.58k stars 863 forks source link

escpos custom font error #1264

Open keophilavanh opened 1 year ago

keophilavanh commented 1 year ago

help me how i can do

` $profile = CapabilityProfile::load("default"); $buffer = new ImagePrintBuffer(); $buffer -> setFont(DIR . '/../../phetsarath_ot.ttf'); $buffer -> setFontSize(12);

$printer = new Printer($connector);

$printer -> setPrintBuffer($buffer); $printer -> text("ລະບົບຮ້ານອາຫານ\n");`

image

sailboat0820 commented 10 months ago

HI Please try modifying ImagePrintBuffer.php line 95 $image -> newImage($metrics['textWidth'], $metrics['textHeight'], $background); change to $image -> newImage( (int) $metrics['textWidth'], (int) $metrics['textHeight'], $background);