NielsLeenheer / ReceiptPrinterEncoder

Create a set of commands that can be send to any receipt printer that supports ESC/POS, StarLine or StarPRNT
MIT License
181 stars 17 forks source link

Alignment is getting ignored for image and an element below it #15

Closed rajinikanth0601 closed 1 month ago

rajinikanth0601 commented 1 month ago

Alignment is not working for images and the element next to image on everycom printer (EC400), same code works fine on shreyan's printer.

Example Code:

let encoder = new EscPosEncoder({ imageMode: "raster" });

let img = new Image();
img.src = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBNgE2AAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ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1Vf3bLZxLtxU4wUxnXlKacWAyhKSoo2n3A6BP81tl0dPOw47qGVyWWnCz7kqcSD0P8gn4ql8EuIc4psRZV3iJDyIrg+HI6X3AysfyFNhBB/girvOgxrnCkQ5jDUuJIbU08w8gLQ4hQ0pKknwQQSCD87r2ww1FYbZZbQyy2kIQ22kJSlIGgAB8ACuudo17pSlaxNKfVKKiKUpRJSlfCbLTBjqeU266EkDqy2VqOyB4A8/dB964N4fZtqb5xSpqQ4qb+9ns2pOhv03t6Ovqulee8jyxeGsRMLh3JuZKniNMlsxXg5Hjhta1LR0QpXuWltvslJIDhIKSOw0zfLHcGsXtkTGMKyGxXe1ONvwZZl3uQ1HdQDpSGXWVIO9kaWFDRIP81y5Xtcbw/VCltXBWTh0lLREbuR9J/Ja3/4rWn6b24DfM1/MB5x1Bx+P27p1o+srVZTm+4ZrmOL4Vb0Y9ORCmNfmZFFjtSUlL7ZZU3G7sJU4ElZdV2QU/wCCn3gK0qpX93KLfd7ffsJw3IbbfYg6uflyrtLE5kHYjKEhr0whR37laKSQQpOiSt70x1vSscm+NKdS3+LNBUpKNmKvQ7DeydfA+z9Vka6pKUpRiaUpRURU68UpQRXrrSlBAoBulKBrzqmvOqUoBFD4pSgAboRqlKH0+qUpRr//2Q==';

encoder.initialize()
    .align('right')
    .line('Text with right alignment 1')
    .align('right')
    .image(img, 400, 400)
    .align('center')
    .line('Text with center alignment 2')
    .align('center')
    .line('Text with center alignment 3')
    .encode();

Print Image:

NielsLeenheer commented 1 month ago

This is probably because the printer only accepts alignment changes at the beginning of a line. Adding a newline after the image will probably solve it.

The upcoming version 3 has a completely different way of dealing with alignment, and does not have this problem.

rajinikanth0601 commented 1 month ago

@NielsLeenheer issue is reproducible with ReceiptPrinterEncoder as well, alignment is not working for the image and all elements below the image.

Example Code :

let encoder = new ReceiptPrinterEncoder({
      language: 'esc-pos',
      columns: 48,
      imageMode: 'raster'
    });

let img = new Image();
img.src = 'data:image/jpeg;base64,/9j/4AAQSkZJRgAB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v03t6Ovqulee8jyxeGsRMLh3JuZKniNMlsxXg5Hjhta1LR0QpXuWltvslJIDhIKSOw0zfLHcGsXtkTGMKyGxXe1ONvwZZl3uQ1HdQDpSGXWVIO9kaWFDRIP81y5Xtcbw/VCltXBWTh0lLREbuR9J/Ja3/4rWn6b24DfM1/MB5x1Bx+P27p1o+srVZTm+4ZrmOL4Vb0Y9ORCmNfmZFFjtSUlL7ZZU3G7sJU4ElZdV2QU/wCCn3gK0qpX93KLfd7ffsJw3IbbfYg6uflyrtLE5kHYjKEhr0whR37laKSQQpOiSt70x1vSscm+NKdS3+LNBUpKNmKvQ7DeydfA+z9Vka6pKUpRiaUpRURU68UpQRXrrSlBAoBulKBrzqmvOqUoBFD4pSgAboRqlKH0+qUpRr//2Q==';

encoder.initialize()
    .align('right')
    .line('Text with right alignment 1')
    .align('right')
    .image(img, 400, 400)
    .align('center')
    .line('Text with center alignment 2')
    .align('center')
    .line('Text with center alignment 3')
    .encode();

Print :

NielsLeenheer commented 1 month ago

I've tested this with the latest code in the repository and it works for me. Tried it with a dozen different printers and I'm not seeing any issue at all.

NielsLeenheer commented 1 month ago

Is this with the 3.0.1 release from earlier today?

rajinikanth0601 commented 1 month ago

Yeah @NielsLeenheer, it is not reproducible on all the printers. As I mentioned, it's working fine with Shreyan's printer but is having issues with the Everycom EC400. Is it possible for you to verify this on that printer? Please check the table below to see how the print is coming out for different cases, I hope that might help you understand the issue better. Please let me know if you need any additional data for debugging this issue.

Print Image   Comments
Working fine
  Working fine
 
  • Text elements are aligned slightly to the right of center
  • Alignment for the image is not working
  •  
  • Alignment breaks for all the elements below the image
  • Alignment for the image is not working
  •   Working fine
      Working fine
      Working fine
      Working fine
      Working fine
      Working fine
      Working fine
      Working fine
     
  • Text elements are aligned slightly to the right of center
  • Alignment for the image is not working
  •  
  • Alignment breaks for all the elements below the image
  • Alignment for the image is not working
  •   Working fine
    rajinikanth0601 commented 1 month ago

    @NielsLeenheer This was with last week's main branch code of ReceiptPrinterEncoder, also, I see 3.0.0 as the latest version.

    NielsLeenheer commented 1 month ago

    The first thing you should try is the latest 3.0.1 release as there were some alignment bugs in last weeks main branch that were fixed in 3.0.0 and some more fixed in 3.0.1.

    rajinikanth0601 commented 1 month ago

    @NielsLeenheer I have taken the latest receipt-printer-encoder.umd.js from main branch and tested now, still facing the same issue.

    rajinikanth0601 commented 3 weeks ago

    Hi @NielsLeenheer, Any update on this issue? Could you please reopen this issue as it is still reproducible on Everycom printers, or let me know if I need to raise a new issue for this?

    rajinikanth0601 commented 4 days ago

    @NielsLeenheer I've been debugging the alignment issue by comparing the encoded bytes between older and newer versions of the library. In the latest version, I noticed that alignment is now handled by adding spaces on the left side of the text. I tried replacing .align(center) with the raw command .raw([0x1B, 0x61, 0x01]), and this resolved the alignment issue for my case.

    Could you please share the reasoning behind the custom alignment handling introduced in the newer version? I’d like to understand if using raw commands might risk breaking functionality under certain conditions. Thank you!