Dear after so many hours of configuration I reached the point that I do not understand why I can not print. I have a debian server with CUPS the idea is that from my API in NODEJS I can print a .pdf. Both the CUPS and NODE throw me the same error. {"version": "2.0", "statusCode": "client-error-bad-request", "id": 27221384, "operation-attributes-tag": {"attributes-charset": "utf-8", "attributes-natural-language": "en-us", "status-message": "No file in print request."}}. If I printed the test page from CUPS it works perfectly. Does anyone know if it is a code problem in NODEJS or a CUPS configuration?
my controller
var ipp = require("ipp");
var printer = ipp.Printer("http://root:[email protected]:631/printers/EPSON_TM-T20II");
var fs = require("fs");
var document;
fs.readFile("C:\\filename.pdf", function(err, data) {
if (err) {
console.log(err)
}
document = data;
});
var msg = {
"operation-attributes-tag": {
"requesting-user-name": "pos",
"document-format": "application/pdf"
},
data: document };
printer.execute("Print-Job", msg, function(err, res) {
console.log(err);
console.log(JSON.stringify(res));
});
fs.readFile("C:\\filename.pdf", function(err, data) {
if (err) {
console.log(err)
} else {
var msg = {
"operation-attributes-tag": {
"requesting-user-name": "pos",
"document-format": "application/pdf"
},
data: data };
printer.execute("Print-Job", msg, function(err, res) {
console.log(err);
console.log(JSON.stringify(res));
return
});
}