简体   繁体   中英

PHP / JavaScript Print Document Without Opening It

I need to send a file to a local workstations default printer, but I do not want the user to have to interact with downloading it or deal with a popup. The interface is a local web intranet webpage.

<select name=”s-1” id=”s_1”>
<option value=”0”>Please Select…</option>
<option value =”file1.doc”>File1.doc</option>
<option value =”file2.doc”>File2.docx</option>
<option value =”file3.doc”>File3.doc</option>
</select>
<input type=”button” name=”b_1” id=”b_1” value=”Print Selected File”>

All files will be Microsoft Word .doc or .docx files. The workstations are terminals and don't have any office products installed. I just want to send a selected file directly to the terminals default printer with either JavaScript or PHP with "onclick" or "post" events.

Provided that it's intranet page, can you just identify user's own printer from LDAP, etc.? Do you have print server(s) in the network? If so, send it directly from PHP to the print server. It may be tricky however to print .doc or .docx from PHP script without external calls to MS Office or LibreOffice.

If the above is not possible, try to use Java of Flash applet to print from the browser. It may be useful to convert the documents to PDF before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM