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 101 forks source link

[1092:0605/115531.410:ERROR:print_render_frame_helper.cc(2264)] Printing failed. #107

Open janafsal opened 1 year ago

janafsal commented 1 year ago

[1092:0605/115531.410:ERROR:print_render_frame_helper.cc(2264)] Printing failed. @Hubertformin could you please advice about this error

janafsal commented 1 year ago

this error occured when print while silent is true and while it is false it prints correctly

Jerald042615 commented 1 year ago

Same error occurred on me when printing in silent.

janafsal commented 1 year ago

I could print correctly when i change pageSize: '80mm' instead of width property but the the error still shows in the terminal

Jerald042615 commented 1 year ago

Ow really? What printer are you using? Mine shows error and not printing.

Jerald042615 commented 1 year ago

const options = { silent: true, preview: false, margin: '0 0 0 0', copies: 1, printerName: 'POS-80C', timeOutPerLine: 4000, pageSize: "80mm" // page size }

const data = [{
    type: 'text',                                       // 'text' | 'barCode' | 'qrCode' | 'image' | 'table
    value: 'SAMPLE HEADING',
    style: {fontWeight: "700", textAlign: 'center', fontSize: "24px"}
}]

PosPrinter.print(data, options).then(response => console.log(response)).catch(error => console.log(error))

this is my configuration, 

And my error shows,

[23996:0620/204757.414:ERROR:print_render_frame_helper.cc(2302)] Printing failed. [TimedOutError] Make sure your printer is connected

Jerald042615 commented 1 year ago

When silent is equals to false, I can print with print dialog. Which is not the behavior I want to.

Jerald042615 commented 1 year ago

What version are you using by the way?

janafsal commented 1 year ago

const options = { silent: true, preview: false, margin: '0 0 0 0', copies: 1, printerName: 'POS-80C', timeOutPerLine: 4000, pageSize: "80mm" // page size }

const data = [{
  type: 'text',                                       // 'text' | 'barCode' | 'qrCode' | 'image' | 'table
  value: 'SAMPLE HEADING',
  style: {fontWeight: "700", textAlign: 'center', fontSize: "24px"}
}]

PosPrinter.print(data, options).then(response => console.log(response)).catch(error => console.log(error))

this is my configuration, 

And my error shows,

[23996:0620/204757.414:ERROR:print_render_frame_helper.cc(2302)] Printing failed. [TimedOutError] Make sure your printer is connected

try this code below

const { PosPrinter } = require("electron-pos-printer");

data = [ { type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table value: "||---", style: {textAlign:'left',fontSize:'12px',margin:'0'},
}, { type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table value: "Test print

", style: {textAlign:'center',fontWeight:'700',fontSize:'18px',margin:'0'}, }, { type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table value: "My printer", style: {textAlign:'center',fontWeight:'bold',fontSize:'14px',margin:'0'}, }, { type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table value: "
"+ new Date(), style: {textAlign:'center',fontWeight:'bold',fontSize:'14px',margin:'0'}, }, { type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table value: "---||", style: {textAlign:'right',fontSize:'12px',margin:'0'}
}, ] const options = { preview: false, // Preview in window or print pageSize: '80mm',// width of content body margin: "0 0 0 0", // margin of content body copies: 1, // Number of copies to print printerName: printerName, // printerName: string, check it at webContent.getPrinters() timeOutPerLine: 2000, silent: true, };

  const d = [...data];

    PosPrinter.print(d,options)
    .then(() => {
       console.log('printed successfully')

    })
    .catch((error) => {
       console.error(error);

    });
janafsal commented 1 year ago

What version are you using by the way?

"electron-pos-printer": "^1.3.6"

janafsal commented 1 year ago

const options = { silent: true, preview: false, margin: '0 0 0 0', copies: 1, printerName: 'POS-80C', timeOutPerLine: 4000, pageSize: "80mm" // page size }

const data = [{
  type: 'text',                                       // 'text' | 'barCode' | 'qrCode' | 'image' | 'table
  value: 'SAMPLE HEADING',
  style: {fontWeight: "700", textAlign: 'center', fontSize: "24px"}
}]

PosPrinter.print(data, options).then(response => console.log(response)).catch(error => console.log(error))

this is my configuration, 

And my error shows,

[23996:0620/204757.414:ERROR:print_render_frame_helper.cc(2302)] Printing failed. [TimedOutError] Make sure your printer is connected

this might be printer issues, check whether you have installed the latest driver...or check that your printer is online

janafsal commented 1 year ago

Ow really? What printer are you using? Mine shows error and not printing.

it can print any printer like thermal or normal A4 printer

janafsal commented 1 year ago

[1092:0605/115531.410:ERROR:print_render_frame_helper.cc(2264)] Printing failed. even though i could print the error is still there....

thsckdghks13 commented 1 year ago

Results of searching for information about ERROR:print_render_frame_helper.cc (2264) Judging by an error related to chromium embedded with electron

I downgraded my previous electron @25.2.0 to electron @22.2.0 and there is no problem. Try downgrading the electron version.

janafsal commented 1 year ago

But i am using electron 21.0 not 25

Jerald042615 commented 1 year ago

Results of searching for information about ERROR:print_render_frame_helper.cc (2264) Judging by an error related to chromium embedded with electron

I downgraded my previous electron @25.2.0 to electron @22.2.0 and there is no problem. Try downgrading the electron version.

You mean this specific version of electron resolves the issue?

thsckdghks13 commented 1 year ago

2520

The corresponding error occurred in electron@25.2.0

2220

The error did not occur in the electron@22.2.0

210

The electron@21.0 produces an error, but prints.

helhablouj commented 1 year ago

@thsckdghks13 Thank you, I had the exact same issue (printing not working when silent is true with the same error messages), and I managed to solve it by downgrading Electron to version 22.2 as you mentioned.