Comments (4)
OS?
Could you post the script here?
What is the output?
Any other info would help us find the issue.
from node-printer.
Fedora 20, Linux 3.14.6 (64 bits).
The script is a light variant of your basic example:
var printer = require("printer")
var printerName="Stylus-DX7400"
console.log(printer.getPrinter(printerName))
console.log("---------------------")
console.log(printer.getSupportedPrintFormats(printerName))
console.log("---------------------")
console.log(printer.getSupportedJobCommands(printerName))
console.log("---------------------")
printer.printDirect({
data:new Buffer("I will be written"),
printer: printerName,
type: "RAW" ,
success:function(jobID){
console.log("Job sent with ID: " + jobID)
var jobInfo = printer.getJob(printerName, jobID)
console.log("Job info:" + JSON.stringify(jobInfo, null, 2))
},
error:function(err){console.log(err)}
})
And the output is:
{ name: 'Stylus-DX7400',
isDefault: true,
options:
{ copies: '1',
'device-uri': 'usb://EPSON/Stylus%20DX7400?serial=4C3632303346CB2F66&interface=1',
finishings: '3',
'job-hold-until': 'no-hold',
'job-priority': '50',
'job-sheets': 'none,none',
'marker-change-time': '0',
media: 'iso_a4_210x297mm',
'number-up': '1',
'printer-commands': 'AutoConfigure,Clean,PrintSelfTestPage',
'printer-info': 'EPSON Stylus DX7400',
'printer-is-accepting-jobs': 'true',
'printer-is-shared': 'true',
'printer-location': 'minuevofedora-dominio',
'printer-make-and-model': 'Epson Stylus DX7400 - CUPS+Gutenprint v5.2.9 Simplified',
'printer-state': '3',
'printer-state-change-time': '1402955900',
'printer-state-reasons': 'none',
'printer-type': '8556556',
'printer-uri-supported': 'ipp://localhost:631/printers/Stylus-DX7400' } }
[ 'AUTO', 'COMMAND', 'JPEG', 'PDF', 'POSTSCRIPT', 'RAW', 'TEXT' ]
[ 'CANCEL' ]
Job sent with ID: 179
Job info:{
"id": 179,
"name": "node print job",
"printerName": "Stylus-DX7400",
"user": "q2dg",
"format": "RAW",
"priority": 50,
"size": 1,
"status": [
"PRINTING"
],
"completedTime": "1970-01-01T00:00:00.000Z",
"creationTime": "2014-06-16T21:58:48.000Z",
"processingTime": "2014-06-16T21:58:48.000Z"
}
All seems to be ok, but printer doesn't do ANYTHING. It's very strange
Thanks for your interest
from node-printer.
I can see 2 issues:
- data format issue: By sending raw data to printer means that you sending command(s) directly. I don't think for this printer is published a command language. You have to use driver rather than direct commands.
- Encode issue: New Bufer("some text") without the second parameter means will be encoded in utf8. Check which charcode does your printer support.
As a solution try to send a "TEXT" format data without Buffer, like:
var printer = require("printer") var printerName="Stylus-DX7400" console.log(printer.getPrinter(printerName)) console.log("---------------------") console.log(printer.getSupportedPrintFormats(printerName)) console.log("---------------------") console.log(printer.getSupportedJobCommands(printerName)) console.log("---------------------") printer.printDirect({ data:"I will be written", // no new Buffer printer: printerName, type: "TEXT" , // TEXT instead of RAW success:function(jobID){ console.log("Job sent with ID: " + jobID) var jobInfo = printer.getJob(printerName, jobID) console.log("Job info:" + JSON.stringify(jobInfo, null, 2)) }, error:function(err){console.log(err)} })
If you really want to send a RAW data format, then check first printer manual, which command language it does support. I couldn't find any language published for this printer.
The Idea of RAW data format is to print barcodes, payment receipts, etc., are common for termal printers where a command language is published.
from node-printer.
YES!!!! YES!!! YES!!!
You were right!!!
It works!!
Thanks a lot!!!
Now I must learn how to print external files, like Pngs, Odts, Pdfs... because I think it's the most useful functionality (in fact, you know I opened another issue about the lack of this king of examples...I will try to get some working codes to share them).
I close the issue!
Thanks!!
from node-printer.
Related Issues (20)
- Docs unclear - do I need Python on target server, or just on dev machine? Other related questions...
- npm install - The module was compiled against a different Node.js version HOT 3
- Unable to install from NPM HOT 11
- Version NodeJS and Electron HOT 1
- npm published package 0.4.0 doesn't include the fix in #292 HOT 1
- invalid ELF header
- printer.js MODULE_NOT_FOUND after compiling project with pkg HOT 1
- jobs doesnt get filled if printer is a shared printer
- How to get response from device? Not job status HOT 1
- can i delete the Build folder?
- Print PDF from URL HOT 3
- Files spooling but never printing
- Cannot find module './node_printer_darwin_x64.node' HOT 3
- Can't print the Image manipulated by Sharp library & converted into base64 & then after buffer! its prints special characters on Images! HOT 2
- Error: StartDocPrinterW error: code: 1804, message: The specified datatype is invalid. HOT 1
- Error: StartDocPrinterW error: code: 1905, message: ...
- alternative to image printing in windows
- Is it possible to use this on an MacBook M2 ( arm64 )? HOT 1
- Cannot find module './node_printer_win32_x64.node'
- Cant install npm install printer. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-printer.