@amiminn/print-thermal
v1.1.2
Published
package print thermal for ionic capacitor
Downloads
28
Readme
@amiminn/print-thermal
Print thermal library
Hasil Sample Build : Download APK file
Installation
Capacitor print-thermal dengan library dukungan dari @kduma-autoid/capacitor-bluetooth-printer
npm i @amiminn/print-thermalUsage
Import and use the functions as needed:
import { printerSettings, enterLine, sLine, dLine, lineRight, lineLeft, textCenter, textLeft, textRight, QRCode } from "@amiminn/print-thermal";Configure Printer Settings
const commands = printerSettings({ dots: 8, lineSpacing: 30 });
console.log(commands);Print New Line
console.log(enterLine());Print Single and Double Lines
console.log(sLine());
console.log(dLine());Align Text
console.log(textCenter("Centered Text"));
console.log(textLeft("Left Aligned Text"));
console.log(textRight("Right Aligned Text"));Print QR Code
const qrCodeCommand = QRCode({ text: "https://example.com", model: 2, size: 5 });
console.log(qrCodeCommand);example
import { BluetoothPrinter } from "@kduma-autoid/capacitor-bluetooth-printer";
import {
enterLine,
printerSettings,
QRCode,
textCenter,
} from "@amiminn/print-thermal";
function contextPrint() {
let text = "";
text += printerSettings();
text += enterLine();
text += textCenter("thermalPrint @amiminn");
text += enterLine();
text += QRCode({ text: "https://amiminn.my.id" });
text += enterLine();
text += textCenter("React, Typescript, Capacitor");
return text;
}
const printerCommands = contextPrint();
await BluetoothPrinter.connectAndPrint({
data: printerCommands,
address: "66:32:01:0F:7C:4C",
});output

