Could someone answer for this, please? Thanks in advance.
--Prashant Prashant Neginahal wrote: > > Hi, > > I am trying to explore this library to create PDF documents and gone > through all the examples. > > In my application, we query database and get the value objects (java > beans) and out of this we need to create PDF files. I looked at > ExampleJavatoPDF, for me it looks too much of code (with SAXSource). I was > thinking to use JAXB annotations (jaxb is shipped with JDK1.6) and > generate XML stream on the fly and apply XSL to generate PDF. > > The code looks as below. > > JAXBContext context = JAXBContext.newInstance(valueObj.getClass()); > Marshaller m = context.createMarshaller(); > > ByteArrayOutputStream xmlOut = new ByteArrayOutputStream(); > m.marshal(valueObj, xmlOut); > byte[] o = xmlOut.toByteArray(); > xmlOut.close(); > ByteArrayInputStream in = new ByteArrayInputStream(o); > > Source src = new StreamSource(in); > Result res = new SAXResult(fop.getDefaultHandler()); > transformer.transform(src, res); > > It works fine. My question is, is it best practice to generate PDF files > from Java Objects? Is there a better way? Can we generate XSL-FO from Java > objects? > > Thanks in advance. > > Regards, > Prashant > -- View this message in context: http://old.nabble.com/PDF-from-Java-Value-Objects-tp32293814p32366589.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org