I have the following problem, I have an application ruby-on-rails and need to print labels on a printer that is installed on the client computer, how do I print these tags directly from the browser, send direct to the port?
I have the following problem, I have an application ruby-on-rails and need to print labels on a printer that is installed on the client computer, how do I print these tags directly from the browser, send direct to the port?
You can use this plugin to print to the client. Put the jre6 folder in your public and change the code:
function deployQZ() {
var attributes = {id: "qz", code:'qz.PrintApplet.class',
archive:'jre6/qz-print.jar', width:1, height:1};
var parameters = {jnlp_href: 'jre6/qz-print_jnlp.jnlp',
cache_option:'plugin', disable_logging:'false',
initial_focus:'false'};
if (deployJava.versionCheck("1.7+") == true) {}
else if (deployJava.versionCheck("1.6+") == true) {
attributes['archive'] = 'jre6/qz-print.jar';
parameters['jnlp_href'] = 'jre6/qz-print_jnlp.jnlp';
}
deployJava.runApplet(attributes, parameters, '1.5');
}
With this it will be able to list all the printers of the customer's computer and thus be able to print what you want in them.
But a requirement is that the client has jre 7 installed, and it is necessary to give permission on the java control panel so that its java code can be executed.
See the examples of the plugin to understand better.
Hope it helps
The browser does not have direct access to the printer, I would solve it like this:
It would create a desktop application, which would be installed on the client computer.
This app would queries in a print queue (database, api rest, etc.) and print the tags.