In the java web application need to select the file from server and print to the local printer. how it can be done
Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s going to be tricky whenever you require a minimum of user interaction (i.e. just click the link and then do the print magic) and it also depends on the type of the file in question. If it is for example a
.docfile, then you would basically need to download it to the client environment and open it in the default associated application (MS Word in this case) and then let the application execute the print command. You can’t do this from the server side on.Your best bet is to create an Applet which in turn displays the file tree, downloads the file to the local disk file system on client interaction and makes use of
Desktop#print()to print it. E.g.But if it are for example plain
textfiles such astext/html,text/xml, etcetera, then you can make use Javascript to load the file into some<div>or<iframe>element and then execute thewindow.print()method on it, if necessary along with a CSS media rule.