I'm hardly an expert on this, but what I do is.
1. create a jdom tree representing my data
2. write the jdom tree to XML using it's built-in output generators
3. hand write an xsl file
4. pass the xsl and xml to fop

I realize that I can skip step 2 and do this part internally, but I had
trouble getting all the IO objects to match up and was under the gun.  Also
the files make it easy to test and tweak your xsl until you've got it right.

-----Original Message-----
From: catal [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 10:11 AM
To: [EMAIL PROTECTED]
Subject: Database data - PDF [spam-BCC][Faked From
Address][html-removed]


HI

I used FOP for about 6 months for generating dinamic PDFs. Mainly the
reports I generate are in table-like form and currently I use the following
pattern:
I get data from PostgreSql database. I've have made a library from classes
that wraps fo elements. For example I build a table cell using:

 FoTableCellAttributes rowCellAtrs = new
FoTableCellAttributes(FoColors.WHITE, new FoSize(1,FoUnits.PT).toString(),
new FoSize(0.5,FoUnits.PT).toString(), FoBorder.BORDER_STYLE_SOLID, null);
 FoBlockAttributes rowBlockAtrs = new FoBlockAttributes(FoFonts.TIMES,new
FoSize(10,FoUnits.PT),FoColors.RED,FoAlign.TEXT_ALIGN_JUSTIFY,null,null,null
,null,FoAlign.VERTICAL_ALIGN_MIDDLE);
new FoTableCell("text i want in this cell",rowBlockAtrs,rowCellAtrs)

of course I have classes for table and flows and allmost everything I need
to put in an PDF file. 
All this classes overrides "toString" method so every class will print the
corresponding Fo code. For example FoBlock class will have it's "toString"
result something like:<fo:block font_size..... 
Now all this classes are using the hierachy that fo elements have, so all
this classes are added to their parents and finnaly to a class that
represents the fo container.
After i build this container I use a DataOutputStream to put the "toString"
representation of all this classes in a Fo file. This file I pass to FOP to
convert to PDF.
The main problem is that this mechanism takes quite a long time to get done.


Now the question: Is that a better way to do this? I realy have the feeling
that there is way to do this more easily and more optimal.

--
--
----------------------------------------------------------------------------
-------------------
Dumitru Marius Catalin                   S.C. Vision Systems S.R.L.
( IT Consultant )                                 Mihail Kogalniceanu 21
                                              Business Palace - Centrul
Civic
                                                                   Brasov,
Romania

voice: +40-723-508411                 Tel./fax. +40-268-419755
http://www.vision-systems.ro                               Homepage

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to