Send image to print automatically from web app (html, js and php)

Asked

Viewed 991 times

0

Hello, I have a webapp where I take a photo with a frame for a badge and save it on the server, but I needed to have this image print automatically, ignoring that prompt that appears when we have something printed in the browser for example.

I tried software in java, I made the program that I had printed in java, but when I called its execution through exec() php it does not see any printing service, I asked a question about this case here already, but I could not solve.

This will run on two machines, but each will have a local server installed, and will run in a controlled environment. Then it may be some "gabiarra" even, but since not having that prompt is a system requirement, I need some way to make it work.

Any suggestions?

1 answer

1

php has a library to do this http://www.php.net/manual/en/ref.printer.php

Use

<?php
$texto = "Conteúdo a ser impresso";
$_SESSION['PrintBuffer']="$texto"; 
$handle=printer_open("nome_da_impressora_no_windows");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, $_SESSION['PrintBuffer']);
printer_close($handle);
?>

I didn’t run the test because there is no printer here, but I believe you will get direct printing without going through a prompt.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.