Bruno Lipovac
Bruno Lipovac

Reputation: 447

Printer prints garbage after reinstalling driver

Recently I made an Electron app with Nuxt for renderer process. The app is for a local pizza place, it polls the existing wordpress app endpoint for new orders and prints new orders on a POS printer (bixolon-srp350-plus) whenever there is a new order. The app uses built-in electron webContents.print() method to print a simple page window which represents the order slip (address, contact info, order specifics, etc).

everything was working fine until one day the printer driver went missing, no idea how. I reinstalled the driver and since then my print output comes out in garbled hieroglyphics and the printer beeps (incorrect file format i guess). I cannot even print a test page from Windows Control Panel.

The app is running on win7 32bit, the printer is connected with usb/usb interface.

I've tried: reinstalling the driver, changing paper settings, changing font size in my order page to a lower value(it printed "fine" with font-size:2px obviously the text was unreadable), in printer properties/advanced i've tried enabling printing directly to printer.

Also, there was an earlier app written in C# which had a bloated file issue or something which caused it to crash every once in a while. So my guess is that the person who wrote it also set up the printer which made my app work as well, alas i have no way of getting hold of that person.

Many thanks in advance, hope somebody had some related issues, Cheers!

Upvotes: 0

Views: 626

Answers (1)

Bruno Lipovac
Bruno Lipovac

Reputation: 447

Solved the issues, the printer was actually to blame. Bought a new Bixolon SRP-150. Word to the wise: pay attention this sentence from the docs "When silent is set to true, Electron will pick the system's default printer if deviceName is empty and the default settings for printing."

Setting only contents.print({ silent: true }), will make your life a whole lot easier. Using default printer setting will ensure your webContents print properly no matter what printer is connected to the machine.

Upvotes: 0

Related Questions