File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Saving a PDF automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Saving a PDF automatically" Watch "Saving a PDF automatically" New topic
Author

Saving a PDF automatically

Benita Perkins
Greenhorn

Joined: Jul 18, 2008
Posts: 9
I am trying to save a pdf file to my server.
When I use "res.setContentType(application/pdf);" it opens the "Save As" window for the user to save the file to their machine where I need it to go to the server....
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3947
    
  17

You shouldn't be using the response to save the file if you want the file saved to the server. The response is used to send data to the client.

So since you want to save the file on the server use a FileOutputStream to the destination and save the contents to it rather than the response.


Steve
Benita Perkins
Greenhorn

Joined: Jul 18, 2008
Posts: 9
so, I shouldn't be setting the MIME at all then?

I have to edit someone else's code and they were a lot more advanced than I am. This is the code.....


Could you take a look and let me know if the MIME should be set?
 
 
subject: Saving a PDF automatically
 
Similar Threads
Cache file(pdf) in user's computer using Servlet-Cookie, or Session
How can I print my pdf file to printer using swt and save the pdf file
saving the excel file is a specific location
Save pdf from http inputstream to file
How to open a local file in Java program