1

I'm using the ipp npm module to send a print job from a google cloud function. I believe I have set up the printer correctly but I don't know how I'm supposed to know the exact uri for sending the print job. The printer model is Brother MFC-L3770CDW Here is how my settings look in the web view for the printer configuration.

screenshot

And here is the function code.:

    var ipp = require('ipp');
var PDFDocument = require('pdfkit');

var doc = new PDFDocument;
doc.text("Hello World");

var buffers = [];
doc.on('data', buffers.push.bind(buffers));
doc.on('end', function () {
var printer = ipp.Printer("https://10.0.0.55:443");
var file = {
    "operation-attributes-tag":{
        "requesting-user-name": "User",
    "job-name": "Print Job",
    "document-format": "application/pdf"
    },
    data: Buffer.concat(buffers)
};

printer.execute("Print-Job", file, function (err, res) {
    if(err) {
        console.log(err); 
    }
    else{
        console.log("Printed: "+res.statusCode);
    }
});
console.log('executing');     
});
doc.end();
console.log('finished executing'); 

I have tried various uris such as https://10.0.0.55:631 https://10.0.0.55:443 https://10.0.0.55:631/ipp https://10.0.0.55:631/ipp/printer

Sometimes I get an error like:

"Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1148:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
  code: 'ECONNRESET',
  path: null,
  host: '10.0.0.55',
  port: '631',
  localAddress: undefined }"
Marcus Gallegos
  • 1,532
  • 1
  • 16
  • 31
  • 1
    Did you ever find a solution to your question? Right now, we are stuck with a very similar problem – Golo Roden Sep 25 '19 at 09:49
  • No. We ended using Zapier with Google Cloud Print. IPP just seems to be this mysterious thing that nobody can figure out. Please post back if you do! Thanks :) – Marcus Gallegos Sep 26 '19 at 13:28
  • BTW, The main reason we want to to this is to print to existing receipt printers. What is your context?@GoloRoden – Marcus Gallegos Sep 26 '19 at 13:29

0 Answers0