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

Print Text Size issues #138

Open
shersoftgithub opened this issue Apr 6, 2024 · 0 comments
Open

Print Text Size issues #138

shersoftgithub opened this issue Apr 6, 2024 · 0 comments

Comments

@shersoftgithub
Copy link

when i print first time it get correct result on BPOS T2 bluetooth80mm printer second time it get large sized font.
when i power off and on again the print will perfect at firs time after that it get large sized.

code :
{
.....................
printerManager.selectPrinter(printer);

var printerSize = '3';
PaperSize paper = PaperSize.mm80;
if (printerSize == "2") {
  paper = PaperSize.mm58;
} else if (printerSize == "3") {
  paper = PaperSize.mm80;
} else if (printerSize == "4") {
  paper = PaperSize.mm112;
} else if (printerSize == "5") {
  paper = PaperSize.mm58;
}

PosPrintResult res =
await printerManager.printTicket(await test(paper));
}

Future<List> test(PaperSize paper) async {
var profile = await CapabilityProfile.load();
final Generator ticket = Generator(paper, profile);
List bytes = [];
// printerSize = '3';

try {
  bytes += ticket.text(
    'COMAPMY NAME',
    styles: const PosStyles(
        align: PosAlign.center,
        bold: true),
  );
  bytes += ticket.text('');

  bytes += ticket.text('ADDRESS 1 XXXXX',
      styles: const PosStyles(align: PosAlign.center));

  bytes += ticket.text('ADDRESS 2 XXXXX',
      styles: const PosStyles(align: PosAlign.center));

  bytes += ticket.text('ADDRESS 3 XXXXXX',
      styles: const PosStyles(align: PosAlign.center));

  bytes += ticket.text('PH:XXXXXXXXXX',
      styles: const PosStyles(align: PosAlign.center));

  bytes += ticket.text('GSTNO : XXXXXXXXXXXXXXX',
      styles: const PosStyles(align: PosAlign.center));
  bytes += ticket.text('INVOICE',
      styles: const PosStyles(align: PosAlign.center, bold: true));

bytes += ticket.hr();
   bytes += ticket.row([
     PosColumn(
         text: 'Invoice No : B XX-XX/123',
         width: 12,
         styles: const PosStyles(align: PosAlign.left)),
   ]);
   bytes += ticket.row([
     PosColumn(
         text: 'Date : 05-04-2024  11:55 AM',
         width: 12,
         styles: const PosStyles(align: PosAlign.right)),
   ]);
   bytes += ticket.hr();
   bytes += ticket.text(
       'Bill To : CUSTOMER NAME XXXXXX',
       styles: const PosStyles(align: PosAlign.left));

   bytes += ticket.hr();
   bytes += ticket.row([
     PosColumn(text: 'Description', width: 7),
     PosColumn(text: 'Qty', width: 1),
     PosColumn(
         text: 'Price',
         width: 2,
         styles: const PosStyles(align: PosAlign.right)),
     PosColumn(
         text: 'Total',
         width: 2,
         styles: const PosStyles(align: PosAlign.right)),
   ]);
  bytes += ticket.hr();

  bytes += ticket.row([
     PosColumn(
       text: itemName,
       width: 7
     ),
     PosColumn(
       text: '1NO',
       width: 1
     ),
     PosColumn(
         text: '10',
         width: 2,
      ),
     PosColumn(
         text: '10',
         width: 2
     ),
   ]);
    --------------------
  -------------------
 bytes += ticket.feed(2);
  // bytes += ticket.cut();
  return bytes;

} catch (e, s) {
bytes += ticket.feed(2);
return bytes;
}
}

1st ok
https://drive.google.com/file/d/154gUgMsWhcAe9SPWBErYS_RC0B1cvNBK/view?usp=drive_link

2nd
https://drive.google.com/file/d/1ykj2S2W9EEkByZeAa0RgZIuAvC-7wHnY/view?usp=drive_link

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

1 participant