Question

Is it possible to send an IPP Print request from the browser using ajax?

I assume it would look something like this:

// Data to be sent
var data = "Testing\nTesting\n1\n2\n3";

// Jquery AJAX call
$.ajax("ipp://<printerip>:631", {
    'type': 'POST',
    'data': data,
    'complete': function(jqXHR, textStatus){
        alert('Result:'+textStatus)
    }
}); 

The only problem is I get:

XMLHttpRequest cannot load ipp://<printerip>:631. 
Cross origin requests are only supported for HTTP.

Is there anyway to get around this? Or is this simply impossible?

Was it helpful?

Solution

  • The only thing AJAX and IPP have in common is HTTP
  • IPP messages are byte-encoded not XML- or JSON-encoded
  • You'd need to convert XML/JSON to proper IPP (honestly: doesn't make sense)

There's a pure JavaScript IPP implementation available at https://www.npmjs.com/package/ipp (not sure if it runs in browsers)

Answer: It's not possible to send an IPP request using ajax.

OTHER TIPS

There are chrome extensions which can trigger IPP Print. As chrome doesn't provide any API specific for this, I assume it is possible to trigger IPP printer by Frontend technology alone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top