0

We have a database that stores part numbers and work instructions for these parts. All work instructions are saved as Microsoft Word doc or docx.

Functionality a web page is shown, a user selects the part they are working on from a drop down and the clicks the print button. We query the database for the correct document and send it to the local OS print function.

Is there a way to send a command through Javascript/HTML/PHP to print the document without opening the document in the browser?

Edit for clarity. We are running a web (http) application. The files for the worksheets that need printed are on a local server inside the web application, and the person will be using the http web application via a local intranet workstation. All the printers are IP printers and networked via the local server.

In a local database (accessed via the web application) I store the path to the worksheet that needs printed. So using html/php a user select the part they are working on, then clicks a html print button. When they click the print button I need to query the database to get the document path and name, and send it to printer. I don't want the user to have to interact with a pop up, I just want the document sent to the local workstations default printer.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
nodsdorf
  • 235
  • 1
  • 4
  • 17
  • sorry, Is the printer on your end or the viewers end? – DannieCoderBoi Feb 09 '15 at 12:50
  • The printer would be on the web server (local intranet), but can be if needed to be on the workstation as well. – nodsdorf Feb 09 '15 at 13:04
  • Is the person that is ordering the document on the same system as yours? What do you mean we query the database? Do you physically check the database for the item that has been submitted? – DannieCoderBoi Feb 09 '15 at 17:27
  • 1
    By the same system I mean a system boundary. Is the person that clicks the print button a regular web page visitor or is it a member of staff? - Either way I think you should get the IP address of the printer stored and run a script that will get the files and FTP them to that printer (only works locally). That should just start it off without opening it. Sorry your question is very clear so I cant properly give you an example. – DannieCoderBoi Feb 09 '15 at 17:32
  • I will try edit it for clarity. – nodsdorf Feb 09 '15 at 19:56

1 Answers1

0

Right in that case - When the web application has got the correct information from the database, it should then locate the local file and PHP that file to the IP address of the selected Printer.

This post might answer your question:

Uploading file through FTP using PHP

or the PHP manual:

http://php.net/manual/en/book.ftp.php

Sorry, I have not used this before so cannot help more. I suggest you try this and post an problem you encounter here :)

Community
  • 1
  • 1
DannieCoderBoi
  • 728
  • 2
  • 12
  • 31
  • I appreciate the help. Maybe I'm missing something but I don't think I need to FTP a file to my printer. I have the files stored on the web I just want them printed to the local workstation. I will try and ask again more clearly. – nodsdorf Feb 17 '15 at 15:00
  • by using FTP you can use PHP and link it to your MySQL query - that is what I was thinking. Its the best way for what you are thinking. I believe. Sorry if not helpful. – DannieCoderBoi Feb 17 '15 at 17:58