receipt-print-hq / escpos-tools

Utilities to read ESC/POS print data
MIT License
201 stars 73 forks source link

esc2html: Uncaught ImagickException: insufficient image data in file #66

Open mike42 opened 4 years ago

mike42 commented 4 years ago

This relates to the data file in issue #64.

We expect to get the text presented by esc2html in a HTML page (plus a pile of warnings), but instead it crashes with an ImagickException.

$ php esc2html.php examples/2019-10-ascii.txt  
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE �
WARNING: Unknown command DLE �
WARNING: Unknown command DLE �
WARNING: Unknown command DLE �
WARNING: Unknown command DLE !
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE A
WARNING: Unknown command DLE @
WARNING: Unknown command DLE !
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE A
WARNING: Unknown command DLE @
WARNING: Unknown command DLE !
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE !
WARNING: Unknown command DLE D
WARNING: Unknown command DLE @
WARNING: Unknown command DLE !
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE !
WARNING: Unknown command DLE D
WARNING: Unknown command DLE @
WARNING: Unknown command DLE 
WARNING: Unknown command DLE NUL
WARNING: Unknown command DLE �
WARNING: Unknown command DLE �
PHP Fatal error:  Uncaught ImagickException: insufficient image data in file `' @ error/pnm.c/ReadPNMImage/443 in /home/mike/workspace/escpos-tools/src/Parser/Command/StoreRasterFmtDataToPrintBufferGraphicsSubCmd.php:81
Stack trace:
#0 /home/mike/workspace/escpos-tools/src/Parser/Command/StoreRasterFmtDataToPrintBufferGraphicsSubCmd.php(81): Imagick->readimageblob('P4\n39107 49665\n...', 'pbm')
#1 /home/mike/workspace/escpos-tools/esc2html.php(101): ReceiptPrintHq\EscposTools\Parser\Command\StoreRasterFmtDataToPrintBufferGraphicsSubCmd->asPng()
#2 /home/mike/workspace/escpos-tools/esc2html.php(64): imgAsDataUrl(Object(ReceiptPrintHq\EscposTools\Parser\Command\StoreRasterFmtDataToPrintBufferGraphicsSubCmd))
#3 {main}
  thrown in /home/mike/workspace/escpos-tools/src/Parser/Command/StoreRasterFmtDataToPrintBufferGraphicsSubCmd.php on line 81