xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas L Delmelle <a_l.delme...@pandora.be>
Subject Re: create FONode objects directly and generate PDF file
Date Thu, 22 Nov 2007 07:14:20 GMT
On Nov 21, 2007, at 20:57, Daling Xu wrote:

Hi

> I fully understand the process of from Java Obj -- > xml --> Fo  
> file --> PDF and already made it work in my application.
>
> But is it possible directly create FONode objects, e.g. Flow, Table  
> in my java code and then call a FOP api (maybe a Renderer or  
> something) to generate a PDF file from the root FONode object?

I guess it is possible, but FOP's API is not designed to facilitate  
such an approach, so even if it can be done, it might turn out to be  
more trouble than it's worth. It's definitely not documented  
anywhere, so you would be on your own.

> I am thinking this way because my data are in java object, then  
> write a method to generate XML and create a XSLT file, all these  
> steps could bring in complication and bug, why not directly  
> generate the FO objects and generate the PDF, anyway I know which  
> object in my data should generate what kind of things in my PDF.

Yours is a valid point, but on the other hand, generating FO directly  
from Java also has its drawbacks. I think one of the key  
disadvantages is that you will end up writing a significant amount of  
proprietary code/classes for tasks/processes for which there are well- 
established standards (XML, XSLT...). You would indeed reduce the  
number of steps, and possibly the number of bugs, but those bugs that  
do pop up will be far more difficult to track, if I judge correctly.

After all, look at it this way: the specification is called 'XSL-FO'  
and not plain 'FO'. It is precisely meant to be used in conjunction  
with XSLT to transform semantic XML input.
Compare it with HTML: it's possible to not use CSS at all, and apply  
all styling manually, but by doing so, you are giving up the  
advantage of keeping all style-related information nicely separated  
from the content.


Cheers

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message