wood burning stoves 2.0*
The moose likes Struts and the fly likes File from database save as pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File from database save as pdf" Watch "File from database save as pdf" New topic
Author

File from database save as pdf

Honzak Troubak
Ranch Hand

Joined: Jan 11, 2013
Posts: 31
Hello,

I don't know how save pdf file from database as pdf file.

I have link



and action (maybe it's mistake but I don't know how make it better)



This action calls method readPaperFile()



When I click on link, I can download file readPaperFile.action (same name like name of action). If I rename file to file.pdf, file will open via Acrobat Reader and everything is great. But I can't save file as pdf type, everytime it is readPaperFile.action.

Does anybody know how resolve it?

Thank you very much
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41115
    
  45
You need to set a Content-Disposition header, something like this:

response.setHeader("Content-Disposition", "attachment; filename=\"my-awesome-content.pdf\"")

Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File from database save as pdf
 
Similar Threads
how to use large objects,images blob
s:url and javascript onclick submit
Servlet to open a pdf
Sending a parameter with <s:url.../>
File download in struts2