are you sure, that there isn't a simplier way to do that with xml, xsl -> pdf???
please write down, what classes do you import thanks
Fishy
Samimi, Ashkan (Contractor) wrote:
Try this: This is by the way a part of my servlet.....
parser = new DOMParser(); parser.parse("invoice1.xsl"); document = parser.getDocument(); Driver FOPDriver = new Driver(); ByteArrayOutputStream out = new ByteArrayOutputStream();
FOPDriver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
FOPDriver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
FOPDriver.addElementMapping("org.apache.fop.extensions.ExtensionElementMappi ng");
FOPDriver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
FOPDriver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
FOPDriver.addPropertyList("org.apache.fop.extensions.ExtensionPropertyListMa pping"); FOPDriver.buildFOTree(document); FOPDriver.setOutputStream(out); FOPDriver.setRenderer(FOPDriver.RENDER_PDF); FOPDriver.format(); FOPDriver.render(); byte[] content = out.toByteArray(); response.setContentType("application/pdf"); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush();
-----Original Message----- From: Alexandre Denes dos Santos [mailto:[EMAIL PROTECTED] Sent: 28 February 2002 14:23 To: [EMAIL PROTECTED] Subject: Re: calling fop from java
I´m working in something like that.
I have an servlet filter that calls a JSP page that will return an xml file with a set of pre-defined tags. This xml file will be transformed into a fo stream with xalan using a xsl file with the fo definition of my tags. This fo stream will be then rendered with fop. (I hope that the English is correct...)
I'm sending the code for the filter, the xsl that I have and a xml example for my tags. It´s is working, but the tags are still very limited because I´m still in the begining of the project.
I´m also working in a wysiwyg tool to create the xsl file.
Hope that helps.
Denes
----- Original Message ----- From: "Fischer Tibor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 28, 2002 11:06 AM Subject: Re: calling fop from java
that's ok, sorry but i didn't said, that i have an xml, and an xsl file, and i have to generate the pdf from them
Fishy
Alexandre Denes dos Santos wrote:
Use:
Driver driver = new Driver(InputStream in, OutputStream out); driver.setRenderer(Driver.RENDER_PDF);
driver.run();
where in is the inputStream to the fo file that you will render and out is the outputstream where the pdf content will be write to.
The package is org.apache.fop.apps.
Hope that helps.
Denes
----- Original Message ----- From: "Fischer Tibor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 28, 2002 10:50 AM Subject: calling fop from java
hi
i would like to call the fop's transformation procedure from a running java application, to create pdf realtime
how is it possible?? what method sholud i call??
Thanks, Fishy