NielsLeenheer / ReceiptPrinterEncoder

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

.align('center') not working after upgrade to v3.0.0 #39

Closed lajith111 closed 2 weeks ago

lajith111 commented 1 month ago

.align('center').height(size).line(print.RecieptName ?? '',32).height(1)

Here print.RecieptName not constanct value.. after i search align is deprecated..

How can i achived same using new version..Please let me know

NielsLeenheer commented 1 month ago

Align should still work. Not aware of any issues. But the second argument of the line() function is no longer supported. To archive a similar effect you can use the box() function with a style of none.

encoder
    .align('center')
    .box(
        { width: 32, align: 'center', style: 'none'}, 
        'The quick brown fox jumps over the lazy dog. ' + 
        'The quick brown fox jumps over the lazy dog. ' + 
        'The quick brown fox jumps over the lazy dog'
    )

Try pasting this in the playground to see the effect: https://point-of-sale.dev/receipt-printer/playground

Screenshot 2024-10-25 at 21 27 06
lajith111 commented 1 month ago

Ok..Thank You..