Re: create FONode objects directly and generate PDF file

2007-12-02 Thread J.Pietschmann

Daling Xu wrote:

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?


If you really want to create PDF in a more direct way, you should
use libraries like iText which are much better suited for this task
then FOP.

J.Pietschmann

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



Re: create FONode objects directly and generate PDF file

2007-11-21 Thread Manuel Mall
On Thursday 22 November 2007 04: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 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.
>
> Anybody get similar experience?
>
Both Jeremias and Andreas pointed out to you the pitfalls in generating 
FONode objects directly. However, there is another approach which is a 
bit 'in between' which may suit you.

You can use the standard DOM API (org.w3c.dom package in the standard 
Java API) to build up a DOM representation of your XSL-FO document in 
memory and give that to FOP as FOP accepts a DOMSource as input. This 
avoids any intermediate serialized XML representation and also skips 
the XSL transformation step. I don't want to pass judgement here if 
that is a good approach or not but I know from experience it can be 
made to work.

> Thanks
>
> Linda
>

Manuel

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



Re: create FONode objects directly and generate PDF file

2007-11-21 Thread Andreas L Delmelle

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: create FONode objects directly and generate PDF file

2007-11-21 Thread Jeremias Maerki
This should be possible and it has been asked before, but in my opinion,
it's a bad idea:
- You hardcode your layout in Java code which makes the whole thing hard
to maintain and requires FO knowledge as well as Java knowledge.
- You have to rewrite the whole transformation functionality in Java
which could much more easily be written in XSLT.
- Using XSLT, you can separate the layout from the processing which
makes the whole things much easier to maintain. Cleaner application
design, too.
- You have to write new Java code for each new layout but you can just
exachange the XSLT if you do the FO generation there. No need to
redeploy the whole application.
- I'm sure you wouldn't get a significant speed improvement if any.
- In the end, I don't find a single point that would speak for the
approach you envision (which reminds me a lot of the way it was done in
the 1980s).

Jeremias Maerki



On 21.11.2007 20:57:36 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 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.
>
>   Anybody get similar experience?
>
>   Thanks
>
>   Linda


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



create FONode objects directly and generate PDF file

2007-11-21 Thread Daling Xu
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 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.
   
  Anybody get similar experience?
   
  Thanks
   
  Linda
   
   

   
-
Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.