I have a servlet where I want when a user press one button, it will generate a dynamic pdf (according to user given data) and download it to user’s c:/ location. Can anybody help me how to do that ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What exactly is unclear to you? How to write an html form? How to get parameters from HttpServletRequest? Or how to generate pdf and download to user?
Then, you can retrieve it in your getXXX method like
If you need to render a pdf, you should look on Apache PdfBox.
And finally, if you in trouble with downloading file to user:
And don’t forget about handilng IOException, which i missed in simpicity purposes.