mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.54k stars 862 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 7 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);