You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Juergen Lippold <jl...@unilog.de> on 2002/05/21 10:22:59 UTC

embedded FOP from Document to PDF

Hello,

I have no Problems reading the XML and the XSL-file and directly generating the PDF-output.
That works fine. But in my application I'm filling the XMl-file, writing it to the harddisk and then starting the FOP-conversion. It would be nice to start the conversion directly with the org.w3c.dom.Document in memory and the XSL-File from harddisk. 
Does someone knows if this is possible with FOP?

Thanks for Help.

Regards 
Juergen Lippold


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: embedded FOP from Document to PDF

Posted by "David B. Bitton" <da...@codenoevil.com>.
ok, here's what ya want to do.  when you perform a xalan xslt transform, you
can specify a SaxResult as the output object.  When you instantiate the
SaxResult object, you pass a ContentHandler object to the constructor.  Ok,
so the question is, what does this have to do with you.

fop's transformation engine is sax driven.  we are given access to the
underlying transformation engine, a SAX ContentHandler by calling
getContentHandler() on the Driver object.  We then pass the return value to
the SAXResult constructor.

the nice thing about doing it this way, is that as xalan transforms the xsl,
it fires SAX events right into fop.  therefore, it's essentially generating
fop's output (pdf for example) at the same time the xml is transformed in
xsl:fo by an xslt stylesheet.

the line of code from my app looks like this:

...
transformer.transform( new DOMSource( doc ), new SAXResult(
driver.getContentHandler() ));
...


also, by doing this, you do not need to pass any document or inputsource or
even call render(), because it all done once the transform finishes.

lemme know if you need an example.

--

David B. Bitton
david@codenoevil.com
www.codenoevil.com

Code Made Fresh DailyT
----- Original Message -----
From: "Juergen Lippold" <jl...@unilog.de>
To: ">" < <fo...@xml.apache.org>
Sent: Tuesday, May 21, 2002 4:22 AM
Subject: embedded FOP from Document to PDF


Hello,

I have no Problems reading the XML and the XSL-file and directly generating
the PDF-output.
That works fine. But in my application I'm filling the XMl-file, writing it
to the harddisk and then starting the FOP-conversion. It would be nice to
start the conversion directly with the org.w3c.dom.Document in memory and
the XSL-File from harddisk.
Does someone knows if this is possible with FOP?

Thanks for Help.

Regards
Juergen Lippold


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: embedded FOP from Document to PDF

Posted by Jeremias Maerki <je...@outline.ch>.
It is. Have a look at http://xml.apache.org/fop/embedding.html. This
page describes how to embedd FOP into your own applications. The info on
this page may already be ahead of time (reflecting changes to logging for
the next release), so you may have to consult the docs directory in the
distribution.

The key method you need to use is Driver.render(Document). Take the
sample with XSLTInputHandler as a template and switch to render(Document).

> I have no Problems reading the XML and the XSL-file and directly generating the PDF-output.
> That works fine. But in my application I'm filling the XMl-file, writing it to the harddisk and then starting the FOP-conversion. It would be nice to start the conversion directly with the org.w3c.dom.Document in memory and the XSL-File from harddisk. 
> Does someone knows if this is possible with FOP?


Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org