Skip to content

problem While Connecting with usb and Showing no DriverΒ #269

@Mufeednm

Description

@Mufeednm

import { ThermalPrinter, PrinterTypes } from "node-thermal-printer";

export const printReceipt = async () => {
try {
console.log("Initializing printer...");
let printer = new ThermalPrinter({
type: PrinterTypes.EPSON,
interface: "printer:TM-T82", // Ensure it's exactly as shown in Get-Printer
driver: "printer" // Explicitly set the driver
});

const isConnected = await printer.isPrinterConnected();
console.log("Printer connected:", isConnected);

if (!isConnected) {
  console.error("Printer not connected!");
  return { success: false, message: "Printer not connected" };
}

printer.alignCenter();
printer.bold(true);
printer.println("πŸ”₯ Hi πŸ”₯");
printer.bold(false);
printer.cut(); 

console.log("Sending print job...");
await printer.execute(); 
console.log("Print job sent!"); 

return { success: true, message: "Printed successfully" };

} catch (error) {
console.error("Printing error:", error);
return { success: false, message: "Printing failed", error: error.message };
}
};

what can i do the npm printer
and in later node there is some prblems

// Run the function
printReceipt();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions