In my application I have to dynamically create a pdf file that has the following parts:
1. A letter from the honcho whose in charge.
2. A table of contents.
3. An explanitory statement that includes a table.
4. A Summary report consisting of 786 lines.
5. A Detail Report consisting of 786 lines.
Reading the tutorial I have written some code that will hopefully work, where the headings, salutations, closings and paragraphs are strings that I place in paragraphs.
Example: String p3Heading = "Introduction";
String P3ParaOne = "The report is organized by the AHFS Pharmacologic-Therapeutic Classification system. Since the products listed are not FDA approved, they have also not been officially classified in this system. Each products therapeutic class designation is based on the pharmacology and classification of similar approved agents or, when there were no comparable approved agents, they were included in the category Unclassified Therapeutic Agents. The information is divided into the following sections:";
Paragraph p3p0 = new Paragraph(Phrase0,p3Heading(FontFactory.getFont(FontFactory.HELVETICA,20)));
Paragraph p3p1 = new Paragraph(Phrase5,P3ParaOne(FontFactory.getFont(FontFactory.HELVETICA,12)));
I think I did the table OK too.
My question is how do I load these reports. Do I create a table and dynamically add rows?
The data for the reports is in a databean that contains two list objects which can be extracted by get methods. Then I would set up an iterator based on the size of the list and do a for kind of statement. Each list object is a list of models, each of which has attributes and has getter methods for each attribute. With each iteration I would get the model . The attributes are drug name, market potential, estimated approval date etc. These I have extracted from a database using a stored proc which is called by the DAO class.
I think I would add each attribute to a cell by imbedding java in the cell. (This PDF document would run in a jsp.
What are your thoughts on this? Am I going in the wrong direction? Any ideas or suggestions would be welcomed. Thanks.