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

Not able to align image in center of thermal paper bluetooth_print 4.3.0 #195

Open
krunalagrawal opened this issue May 25, 2024 · 3 comments

Comments

@krunalagrawal
Copy link

krunalagrawal commented May 25, 2024

Hello,

I want to display an image in center of page, but not getting it displayed on center.
Kindly provide if someone got this working.
Thanks in advance.

Below is my code snippet.

void printOrder(queryParameters) async {
Map<String, dynamic> config = {};
List list = [];
list.add(LineText(type: LineText.TYPE_IMAGE, content: base64Image, align: LineText.ALIGN_CENTER, width: 200, height: 100, linefeed: 1));
list.add(LineText(linefeed: 1));
list.add(LineText(type: LineText.TYPE_TEXT, content: 'Token No.${tokenNo.text}', weight: 1, align: LineText.ALIGN_CENTER, linefeed: 1));
list.add(LineText(linefeed: 1));
list.add(LineText(type: LineText.TYPE_TEXT, content: 'Name: ${accountName.text} ${dateInput.text} ${queryParameters['orderTime']}', weight: 1, align: LineText.ALIGN_LEFT, linefeed: 1));
list.add(LineText(type: LineText.TYPE_TEXT, content: '--------------------------------', align: LineText.ALIGN_LEFT, linefeed: 1));
list.add(LineText(type: LineText.TYPE_TEXT, content: 'Item Qty Rate Amt', weight: 1, align: LineText.ALIGN_LEFT, linefeed: 1));
list.add(LineText(type: LineText.TYPE_TEXT, content: '--------------------------------', align: LineText.ALIGN_LEFT, linefeed: 1));
await bluetoothPrint.printReceipt(config, list);
}

WhatsApp Image 2024-05-25 at 7 02 30 PM

Thanks!

@krunalagrawal
Copy link
Author

Hi, anyone has idea about this issue,
Please share the solution or where i am doing mistake.

Thanks in advance.

@sanxy
Copy link

sanxy commented Jun 9, 2024

@krunalagrawal i tried you code and it worked, the image was at the center. Here is what i think might be wrong:

  1. Check the size of your image, the image i used was 226 x 290 and it worked.
  2. Make sure there isn't extra spaces after your image

@braa26
Copy link

braa26 commented Aug 16, 2024

Hello @krunalagrawal

I’m reaching out to see if you’ve had any success with printing images on iOS using the bluetoothPrint method. Specifically, I’m trying to determine whether the issue you are facing is related to iOS or if it is unique to Android.

I am currently working on a project where I need to print images on iOS, but I’m experiencing difficulties. The images are not printing, and I would appreciate any insights or solutions you might have.

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

3 participants