andriyoganp / blue_print_pos

Helper to use bluetooth print in Android and iOS
Apache License 2.0
34 stars 77 forks source link

Prints large space after printing the receipt #75

Open A7mdlbanna opened 1 year ago

A7mdlbanna commented 1 year ago

When I print an invoice it prints more space after the data I want to print (Its size changes with the size of the total printed data)

note: the extra space doesn't exist when I take the HTML code and turn it into an image. and also when I use

Uint8List invoiceImageBytes = await BluePrintPos.contentToImage(content: receiptText.content);

the output is the invoice with borders on the sides (right, bottom) but with no extra space in the invoice.

but when I use my printer this is what it looks like: invoice

could you please tell me how to avoid getting the space or stopping printing after reaching the end of the data?

and here is the code to start printing the invoice:

    await bluePrintPos.printReceiptText(receiptText, feedCount: 0, useRaster: true,paperSize: utils.PaperSize.mm80 );
arifai commented 1 year ago

Same issue.

A7mdlbanna commented 1 year ago

Same issue.

if you find any solution please let me know

arifai commented 1 year ago

Hi @A7mdlbanna, i found the solution. You can use this package, worked fine for me. And thanks to you @iandis.

A7mdlbanna commented 1 year ago

Hi @arifai Thanks for your help.

I found a way to work around the bug. I realized that the error is after generating the image with contentToImage function which is from the package itself, so i tried to find another package that takes HTML code to avoid Arabic(rtl) issues.

so i found this package that takes a content of HTML (which i used this package to generate) but prints the invoice without large spacing.

ankush-ppie commented 1 year ago

Hello @A7mdlbanna @arifai

Just add this patch in your code or fork this library blue_print_pos. It works for the both platform (Android & iOS) & tested with different thermal printer.

Screenshot 2022-12-25 at 8 31 25 AM

rafiiAP commented 1 year ago

@arifai sudah nemu solusinya kah bang? terus cara pakai packaeg dari @iandis gimana bang?

arifai commented 1 year ago

@arifai sudah nemu solusinya kah bang? terus cara pakai packaeg dari @iandis gimana bang?

Bisa pake cara ini bang:

blue_print_pos:
    git:
      url: https://github.com/iandis/blue_print_pos.git
      ref: refactor/new-bluetooth-package

Tambahin dibagian dependencies. Atau kalo mau pake punya @ankush-ppie caranya sama aja, cuma ganti dibagian url dan ref:

blue_print_pos:
    git:
      url: https://github.com/ankush-ppie/blue_print_pos/tree/master
      ref: master
rafiiAP commented 1 year ago

@arifai oke makasih bang saya coba dulu