Can servlets / jsp output generate output as a .pdf file ?
If yes then how can we achieve that ?
Well, I am not quite sure which of the following two questions you are asking:
Assuming that I already have a program such as StyleReport or Acrobat that builds PDF, how do I use a servlet or JSP page to make it Web-accessible? Are there Java packages that directly generate PDF? If you are asking the former, then the answer is straightforward, as described in Section 7.2 of the book:
1) Do
2) Call the real PDF generation tool.
3) Read the result using an input Stream and the binary
method.
4) Call
(not
-- Writers are for character-based data)
5) Feed the binary data to the client using the
method.
BTW, you would use a servlet for this task, not a JSP page. JSP provides no advantages when generating binary data, only when generating character-based data that contains a mix of stuff you type in directly and dynamically-generated stuff.
If you are asking the second question ("what Java packages are there that generate PDF?"), try looking at some of these sites:
http://xml.apache.org/fop/http://www.lowagie.com/iText/http://www.etymon.com/pjx/http://www.inetsoft.com/inetsoft/solutions/pdf.html Cheers-
- Marty