Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esc2html output error #64

Open
zarafati opened this issue Oct 14, 2019 · 2 comments
Open

esc2html output error #64

zarafati opened this issue Oct 14, 2019 · 2 comments

Comments

@zarafati
Copy link

Hi,
I'm trying to convert an ESCPOS binary file to HTML document.
when I run this command: php esc2html.php ascii.bin >output.html
I get errors:
error

this is the file ascii.bin
ascii.txt

@mike42
Copy link
Contributor

mike42 commented Dec 25, 2019

Can you tell me a bit more about how this file was captured, and what type of printer it is for?

Since our expected output is basically "whatever a real printer would do", I sent your file to a real Epson TM-T20II (USB) to see what it looks like:

cat 2019-10-ascii.txt > /dev/usb/lp0

And this was the output:

2019-12-example

This approximately corresponds with what esc2text does (the difference in the garbled text appears to be due to the fact that your input uses ESC t, which has no effect in these tools yet, see #61)

$ php esc2text.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 �


@┬Ç├╝@?├╛C┬Å├Ç├░?├╝?├ú├░bD@üüDA┬êÇä2├ÇD ├üD DD┬ÇD DB DDD AB@$DD┬îl├â├Ç7├░├á D@$Dpp├╝┬É┬Ç┬Ç ┬ÇD @ ┬ÇD @ ┬Ç┬Ç┬Ç┬Ç

Your input file is not understood by a real ESC/POS printer, so I think that the output is as good as can be expected.

I did find some problems with how we handle errors in esc2html - it crashes due to a malformed image command instead of presenting the same text in a HTML page. That's certainly a bug, but I've raised a separate issue for it (#66), because it's sort of incidental to your problems here.

@mike42
Copy link
Contributor

mike42 commented Dec 25, 2019

I'm also assuming that this is a follow-up to #62, so I've closed that off.

I don't know how you're capturing your files, but if a real printer can't understand them, then these tools won't do any better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants