Closed ferns-it closed 2 years ago
I used this package "esc_pos_utils_plus: ^2.0.1+3" version. but now the printer only printer center.
You need to add the PostAlign.center
tested version: esc_pos_utils_plus: ^2.0.1+6
CapabilityProfile profile = await CapabilityProfile.load();
final generator = Generator(PaperSize.mm58, profile);
List<int> bytes = [];
bytes += generator.setGlobalFont(PosFontType.fontA);
bytes += generator.text("Bussines", styles: PosStyles(align: PosAlign.center));
try the example and tell me
Sorry for the late reply, I tested printing using your sample code. Now, printer is printing on the center but, the problem is I can't able to print align to left or right. Do you have any solutions for this problem ?
My Tested Printer Details : EPSON M335B2
Hope you reply me soon
You can use the same example but use
Letf
bytes += generator.text("Bussines", styles: PosStyles(align: PosAlign.letf));
rigth
bytes += generator.text("Bussines", styles: PosStyles(align: PosAlign.rigth));
You can also use tables, the table must be divided into 12 spaces, each PostColumn -> width
bytes += generator.row([
PosColumn(
text: 'Name:',
width: 8,
styles: PosStyles(
align: PosAlign.left,
),
),
PosColumn(
text: "Smits",
width: 4,
styles: PosStyles(
align: PosAlign.left,
),
),
]);
I already tried this, but it doesn't work. The printer still print on center itself.
Try using the last example to use it to align the text
bytes += generator.row([
PosColumn(
text: 'Name:',
width: 8,
styles: PosStyles(
align: PosAlign.left,
),
),
PosColumn(
text: "Smits",
width: 4,
styles: PosStyles(
align: PosAlign.left,
),
),
]);
I tested the example package, it is working properly. But when I used in my real project. The text is not print in center. I already changed the "Pos Align: Center". But still not working