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]