It's not a secret anymore!
The moose likes JSP and the fly likes Printing Zip Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing Zip Files" Watch "Printing Zip Files" New topic

Printing Zip Files

Vijendra Runwal
Ranch Hand

Joined: Apr 17, 2006
Posts: 52
I need to extract and print some files present on a page on a click of button.

Has anyone tried this ever...

I am using JBoss server, JSP and a struts framework..
I only have download links to individual files present on page..

Please let me know if additional info required..


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

I don't know what you mean by "printing" a zip file.

Are you just trying to create a link to one so that it can be dowloaded by the user?

[Asking smart questions] [About Bear] [Books by Bear]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

You want to print this extracted thing on the server? I ask because printing at the client side is entirely under the control of the person operating the browser.
Vijendra Runwal
Ranch Hand

Joined: Apr 17, 2006
Posts: 52
The file needs to be printed at Client side.

Let me make it simple.
Instead of zip files let's consider a single simple .txt or .doc file. On a JSP page I have name of the file say a.txt(it's a hyperlink, on clicking the link it downloads the file from server location). Now when user clicks on a.txt it's downloded. I want to implement additional functionality which can print the file directly(instead of downloading and then printing separately).

It can be like this, we can have a print button on the page, clicking on print will print the a.txt file contents directly.

Can we implement this functionality.

If yes, is it possible to implement it for multiple files.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You can not.
For security reasons browser do not allow web applications to access the client's file system directly. The most you can do is prompt the user to download it and save it to the location of their choosing.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Printing Zip Files
It's not a secret anymore!