node-printer icon indicating copy to clipboard operation
node-printer copied to clipboard

Printer not printing anything

Open sgomez84 opened this issue 9 years ago • 18 comments

I've been unsuccessful in getting a printout from the sample script. Tried everything but still can't figure out how to get a simple "Hello World" printed out with a default printer.

My default printer is setup like this and using the /examples/print_raw.js capture

I've tried all possible dataType settings to send a print job but still no luck. If I use 'XPS2GDI' only then does a print happen but text is all gibberish. For all other dataTypes the script creates a new job but doesn't send anything to the Print Job Queue.

Do I have to convert text to PCL/PDL or EMF before hand and then run the printDirect() method?

Some light on this would be really nice.

sgomez84 avatar Jun 04 '15 04:06 sgomez84

I got the same issue :/

FlorianBELLAZOUZ avatar Aug 26 '15 06:08 FlorianBELLAZOUZ

@FlorianBELLAZOUZ I had raised this issue and got no response from Ion @tojocky. Some light on this would be really helpful.

sgomez84 avatar Sep 10 '15 12:09 sgomez84

Sorry i don't find solution

FlorianBELLAZOUZ avatar Sep 12 '15 09:09 FlorianBELLAZOUZ

I started a project https://github.com/tojocky/node-pdfium , but unfortunately, I don't have time to finish with a proper test. So far I managed to compile in node google pdfium but didn't test with node-printer.

If you have time, feel free to propose patches.

tojocky avatar Sep 29 '15 05:09 tojocky

Same issue. On Windows XPS2GDI the only type with which printer is working. RAW type do nothing. TEXT and other types throws error: StartDocPrinterW error: code: 1804, message: The specified datatype is invalid.

ComputerHippie avatar Jun 19 '17 14:06 ComputerHippie

@tojocky any updates on this? i'm running into the same problem like the others.

cmnstmntmn avatar Aug 25 '17 13:08 cmnstmntmn

Same problam

MIt9 avatar Sep 29 '17 14:09 MIt9

I cannot print on Windows 10, too. Not even with XPS2GDI.

When i run the following script:

 var printer = require('printer');

 printer.printDirect({
    data:'fs.readFileSync(filename)',
    success:function(jobID){
        console.log("sent to printer with ID: "+jobID);
    },
    error:function(err){
       console.log(err);
    }
 });

The print job list only shows for a few milliseconds the currently sent print job and then the job disappears without printing and any error message.

I don't know what to do...

Batajus avatar Nov 22 '17 14:11 Batajus

@Batajus I've noticed this happens when you send invalid data to the printer. Unclear to me whether this is a case that could be handled by node-printer

thealexbaron avatar Jan 17 '18 23:01 thealexbaron

@thealexbaron I'm a bit confused, i tried it on Windows 7 and the script does work there o.O Either the data are invalid on Windows 10 or something else is not working correctly.

Batajus avatar Feb 13 '18 21:02 Batajus

@Batajus Do you have a working sample with the data that you passed to the printer? It would be great to see what we are doing wrong?

sgomez84 avatar Feb 23 '18 17:02 sgomez84

I have used printDirect with RAW data type on thermal receipt printer (model BEIYANG BTP-2002NP) the printDirect success method runs and logs successfully on console and the job sent to printer but printer does not print , If I order print manually to print it prints the last job was sent to him from printDirect method, How should I fix this?

monajafi avatar Mar 04 '18 03:03 monajafi

I have the same problem. Please give an update on this issue.

ysectitnikhil201 avatar Aug 13 '18 12:08 ysectitnikhil201

Same here, everything goes fine and seems to work properly, but no printing. Windows

guidopontet avatar Aug 12 '19 12:08 guidopontet

Same on MacOS

selenecodes avatar Jan 19 '20 15:01 selenecodes

Hi, there is no solution for this problem? please I need help

vadhack avatar Jan 20 '20 16:01 vadhack

Same on Window 10. It not work with any printer in list although it go to til success funtion callback.

lameco411 avatar Jul 23 '20 04:07 lameco411

I have the same problem

BopItFreak avatar Apr 05 '22 03:04 BopItFreak