question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

garbage after sending image?

See original GitHub issue

Hi folks, thanks for an awesome project!

I’m new to thermal printers and I’m having a little trouble. It seems like, after I print an image, I get a bunch of garbage characters printed out the next time I try to do anything.

With 2.2.0 (from pypi), if I send text('\n') after printing an image, I seem to avoid the issue. In master (3.0a6) that doesn’t help.

I get the same problem even if I use a simple program like this, with an ESC/POS data blob captured from an android esc/pos printer app:

from escpos.printer import Usb
import sys

data = sys.stdin.read()
printer = Usb(0x0416, 0x5011, 0, 0x81, 0x01)
printer._raw(data)
printer.close()

The first time it prints fine, but if I run it again, I see a bit of the image shifted to the right, and then the third time, I get part of the image and garbage. The fourth time, the printout works great, and then the pattern repeats. I could swear it seems like the printer is getting confused, as if it’s missing the end of a command or something. Maybe I’m not doing it right?

test.escpos.zip

Device info

Printer: POS-5890K (this one)

python-escpos version: 2.2.0, 3.0a6

python version: 2.7.14

operating system: Ubuntu 18.04.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
juancarlordcommented, Dec 6, 2021

Thanks the issue was due the printer being very old and not supporting new commands, only old ESC commands were supported by the printer

On Mon, 6 Dec 2021 at 9:54 AM Ismael Ittner @.***> wrote:

My experience:

just put a p.ln() right before p.image(filename) and solved for me… hope it helps someone.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/python-escpos/python-escpos/issues/367#issuecomment-986849972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM2YCSFFXRQ3K75Z4TYLEADUPTFCXANCNFSM4JAEFIQA .

1reaction
angelod1ascommented, Feb 14, 2021

OMG, I think I found out.

Instead of just p.image(image) I did p.image(image, fragment_height=500) (my image is bigger than 500px in height) and IT WORKED.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete or restore your photos & videos - Android
If you have turned on Back up and Sync, photos and videos you delete will stay in your trash for 60 days before...
Read more >
How did we end up collecting photos at trash dumps
Briefly, they required us to take images containing different categories of waste. Each piece had to be labeled using bounding boxes.
Read more >
Image Garbage Collection in OpenShift - Red Hat Hybrid Cloud
The image garbage collector is part of the kubelet and automatically removes unused images from the node when a configured disk usage ...
Read more >
Think You Deleted Your Photos? Photos You Send to Trash ...
You may think when you tap the trash can icon to delete a photo, that photo is no longer on your phone. But...
Read more >
Smile, your trash is getting its picture taken - Monterey Herald
If trash bins are overfilled or if the recyclables are found to be contaminated, Waste Management will send a letter and photo to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found