const path = require("path");
const printer = require("pdf-to-printer");

// Chemin vers le PDF de test
const pdfPath = path.join(__dirname,  "..", "pages", "rapports", "pos", "output", "ticket_50.pdf");

// Nom de l'imprimante
const printerName = "EPSON TM-T20X";

(async () => {
  try {
    console.log("🟢 Impression PDF en cours...");

    await printer.print(pdfPath, { printer: printerName });

    console.log("🖨 Ticket PDF imprimé avec succès !");
  } catch (err) {
    console.error("❌ Test PDF error:", err.message || err);
  }
})();
