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

Content below image gets corrupted on everycom printer #16

Open
rajinikanth0601 opened this issue Aug 27, 2024 · 3 comments
Open

Content below image gets corrupted on everycom printer #16

rajinikanth0601 opened this issue Aug 27, 2024 · 3 comments

Comments

@rajinikanth0601
Copy link

Issue Summary:

When using EscPosEncoder to print images in raster mode, the content below the image gets corrupted. This issue is reproducible on the Everycom bluetooth thermal 3-inch printer(EC400), whereas it works fine on the Shreyans printer.

Steps to Reproduce:

  • Encode an image using the EscPosEncoder in raster mode.
  • Add content (like text) below the image.
  • Print it on an Everycom thermal printer (EC400).

Expected Behavior:

The image and the content below it should be printed correctly without getting corrupted.

Actual Behavior:

  • On the first print, the image prints correctly, but the content below it does not print at all.
  • On the second print, corrupted text appears, followed by the content without image.

Additional Details:

  • Column mode works without corruption but introduces white horizontal lines between images, making it less desirable for our use case.
  • We attempted printing with a 16x height, which resolves the issue for some heights but still fails for heights like 288 and 432.

Code Used for Printing:

let encoder = new EscPosEncoder({ imageMode: "raster" });
let img = new Image();
img.src = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBNgE2AAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAA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oBFD4pSgAboRqlKH0+qUpRr//2Q==';

encoder.initialize()
    .image(img, width, height)
    .newline()
    .text('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc.')
    .newline()
    .encode();

Print Images:

Resolution 416x416:

The image prints correctly, and the content below it is visible without issues.

Resolution 432x432:

First Print: Only the image is visible.

Second Print: Corrupted text, followed by the content below the image.

Printer Details:

The attached image provides the printer model and details used during testing.

@rajinikanth0601 rajinikanth0601 changed the title Content below image gets corrupted in raster mode on everycom printer Content below image gets corrupted on everycom printer Aug 27, 2024
@NielsLeenheer
Copy link
Owner

It may have something to do with the buffer of the printer receiving too much data too quickly. If it receives data quicker than it can handle the buffer will overflow and ignore incoming data. This could cause the printer to miss part of the image data and start printing corrupted text.

How are you sending the data to the printer? Using WebBluetoothReceiptPrinter, or another library?

One thing you could try is to connect it using USB instead, for example using WebUSBReceiptPrinter. If it works that way, we can rule out the printer itself and determine it is indeed the way the data is send.

@rajinikanth0601
Copy link
Author

@NielsLeenheer We are using cordova-plugin-ble-central to transfer the buffer to printer, we also tried with Bluetooth Classic, but the issue is still reproducible.

@NielsLeenheer NielsLeenheer transferred this issue from NielsLeenheer/EscPosEncoder Sep 17, 2024
@rajinikanth0601
Copy link
Author

Hi @NielsLeenheer, Any update on this issue? Please let me know if you need any additional info for debugging this issue.

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

No branches or pull requests

2 participants