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

Reply via email to