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

Alignment and Encoding Issue #25

Open
saaiful opened this issue Aug 22, 2022 · 1 comment
Open

Alignment and Encoding Issue #25

saaiful opened this issue Aug 22, 2022 · 1 comment

Comments

@saaiful
Copy link
Contributor

saaiful commented Aug 22, 2022

DantSu/ESCPOS-ThermalPrinter-Android

Alignment is not working properly in 3inch paper.

new EscPosPrinter(printerConnection, 203, 76f, 48)
76mm width printing area. 80mm - 2mm of marging on each side.
203dpi
48 chars per line

Originally posted by @DantSu in DantSu/ESCPOS-ThermalPrinter-Android#157 (comment)

This seems to solve the issue, but in this repo i dont see any option for setting this.

Also setting encoding is not avaiable but getiing encoding is available !

@patrickbussmann
Copy link
Contributor

Of course you can do:

ThermalPrinter.printFormattedText({
    // ... your settings ...
    printerDpi: 203,
    printerWidthMM: 76,
    printerNbrCharactersPerLine: 48
}, function() {
    console.log('Successfully printed!');
}, function(error) {
    console.error('Printing error', error);
});

As you can see here:
https://github.com/paystory-de/thermal-printer-cordova-plugin/blob/main/src/android/ThermalPrinterCordovaPlugin.java#L312

If you specify the charsetEncoding in the JSON object you can also specify a charsetName and/or charsetId.
Example:

ThermalPrinter.printFormattedText({
    // ... your settings ...
    charsetEncoding: {
        charsetName: 'windows-1252',
        charsetId: 16
    }
}, function() {
    console.log('Successfully printed!');
}, function(error) {
    console.error('Printing error', error);
});

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

2 participants