Question

Is there a JSP script I can run to point to a JPEG file on the local filesystem to be printed to the Windows default printer? Thanks.

Edit: I have the file on my server already. How would I load the file into a browser to run window.print()? Thanks

Was it helpful?

Solution

You will need a java applet if you don't want a server round trip. The applet is required so that you can:

  1. Access the local file system.
  2. Access the printer natively.

The user will need to grant the applet privileges.

Be aware that printing from java is notoriously hard.

OTHER TIPS

You would have to get them to upload the image to your server, then put the jpeg on a page with JavaScript to call window.print(). It's a security violation for webpages to just start reading the local filesystem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top