Print error

Estou a tentar imprimir uma fatura numa impressora 80mm Series Printer.
Consigo abrir uma janela com o conteudo da fatura e aparece as impressoras para escolher mas quando escolho a impressora, sai um pequeno pedaço de papel em branco.
O meu código está assim

ipcMain.on(‘print’, (event, args) => {
printWin = new BrowserWindow({
width: 300,
height: 800,
webPreferences: {
nativeWindowOpen: true,
nodeIntegration: true
},
fullscreen: false
});
printWin.setMenu(null);

const file = ‘data:text/html,’ + encodeURIComponent(args);
printWin.loadURL(file);

printWin.on(‘closed’, () => {
printWin = null;
});

printWin.webContents.once(‘dom-ready’, () => {
printWin.webContents.print();
});
});

Hello @mecms,

Are you sure your content is loaded when doing the print() instruction?
Can you console.log(printWin.webContents) before the instruction and tell us what the console sees?
Because I see in the screenshot the Invoice/Receipt window but is it the same one than printWin? because your code don’t show any title for the window.

Thank you, but it’s done. It was the page size in the printer settings.