Hubertformin / electron-pos-printer

Electron-pos-printer is a plugin that works to ease paper formatting and printing to thermal printers. it currently supports 80mm, 78mm, 76mm, 58mm, 57mm and 44mm printers thermal printers. it is built with Electron.js and Node.js
Apache License 2.0
316 stars 102 forks source link

TimedOut Error #59

Closed sKY02644 closed 2 years ago

sKY02644 commented 2 years ago

Working with quasar a vuejs framework PosPrinter retrurn TimedOut error

code in electron main ipcMain.handle('posPrint', (_event, {data, posoptions}) => { PosPrinter.print(JSON.parse(data), posoptions) .then(() => {}) .catch(err => { console.log(err) }) });

Code in preload contextBridge.exposeInMainWorld('serivcePrinterPrint', { print_service: (data: { data: PosPrintData, posoptions: PosPrintOptions }) => ipcRenderer.invoke('posPrint', data), })

AnggaIPT commented 2 years ago

I got same issue. how to fix it ?

sKY02644 commented 2 years ago

I solved this problem by adding contextIsolation: false in pos-printer.js file line 93.

var mainWindow = new BrowserWindow({ width: 210, height: 1200, show: !!options.preview, webPreferences: { nodeIntegration: true, contextIsolation: false // here } });

Note: this is in the module file not in the main project file.