Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File from database save as pdf

 
Honzak Troubak
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set a Content-Disposition header, something like this:

response.setHeader("Content-Disposition", "attachment; filename=\"my-awesome-content.pdf\"")
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic