You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Kalyan Chakaravarthy <nk...@yahoo.com> on 2002/09/19 18:31:11 UTC
PDF from xml & XSL document objects ?
Hi,
I am trying to modify my existing java class, that can generate different outputs.
Is there a way to generate PDF document with XML Document object and XSL Document Object ? .
(The example that comes with FOP shows how to generate PDF document from XML file and XSL file. But my requirement is not this.)
Thanks in advance,
Kalyan
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Re: PDF from xml & XSL document objects ?
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Todd McGrath wrote:
> Can you modify your existing classes to produce a
> javax.xml.transform.Source? You can pass that to FOP.
There is a DOMSource.
J.Pietschmann
Re: PDF from xml & XSL document objects ?
Posted by clholm <vp...@earthlink.net>.
Try adding the following to your DTD:
<!ENTITY nbsp ' '>
Subsequently, you should be able to safely use in your XSL
stylesheet.
-Carl Holm
Kalyan Chakaravarthy wrote:
> Thanks for your ideas.
>
> Looks like Driver class and XSLTInputHandler classes do not accept DOM
> Document objects.
>
> Driver expects a stream to FO file. Now I have decided to produce an
> intermediate FOP stream. and then feed the same to Driver class.
>
> Every thing seems to be fine. But I use   character in XSL
> document to produce in the result. This character is causing
> problem while producing PDF from intermediate FO file.
>
> It throws an exception: invalid byte 1 of 1-byte UTF-8 sequence (0xa0)
>
> Any ideas ?
>
> Kalyan
>
>
> -----------------------------------------------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
Re: PDF from xml & XSL document objects ?
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Kalyan Chakaravarthy wrote:
> Looks like Driver class and XSLTInputHandler classes do not accept DOM Document objects.
> Driver expects a stream to FO file. Now I have decided to produce an intermediate FOP stream.
This is almost always a bad idea. Look closely at the
code provided to you. Use a DOMSource to pass your
DOM documents to the transformer. The result is
piped to the FOP driver through a SAXResult.
You can take a look at the Java documentation for
further ideas.
> Every thing seems to be fine. But I use   character in XSL document to produce in the result. This character is causing problem while producing PDF from intermediate FO file.
> It throws an exception: invalid byte 1 of 1-byte UTF-8 sequence (0xa0)
You've got a problem with the file encoding, and with long
lines in your mail. For the first, look into the XSL FAQ,
reachable from
http://www.mulberrytech.com/xsl/xsl-list/
J.Pietschmann
RE: PDF from xml & XSL document objects ?
Posted by Kalyan Chakaravarthy <nk...@yahoo.com>.
Thanks for your ideas.
Looks like Driver class and XSLTInputHandler classes do not accept DOM Document objects.
Driver expects a stream to FO file. Now I have decided to produce an intermediate FOP stream. and then feed the same to Driver class.
Every thing seems to be fine. But I use   character in XSL document to produce in the result. This character is causing problem while producing PDF from intermediate FO file.
It throws an exception: invalid byte 1 of 1-byte UTF-8 sequence (0xa0)
Any ideas ?
Kalyan
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
RE: PDF from xml & XSL document objects ?
Posted by Todd McGrath <mc...@supergloo.com>.
Can you modify your existing classes to produce a
javax.xml.transform.Source? You can pass that to FOP.
Simple Example:
Source strSource = new StreamSource(new StringReader(xmlString));
...
Driver driver = new Driver();
ByteArrayOutputStream out = new ByteArrayOutputStream();
// FileOutputStream out = new FileOutputStream( "filename.pdf" );
driver.setRenderer(driver.RENDER_PDF);
driver.setOutputStream(out);
Result saxResult = new SAXResult( driver.getContentHandler() );
transformer.transform( strSource, saxResult );
-----Original Message-----
From: Kalyan Chakaravarthy [mailto:nkalyanc2000@yahoo.com]
Sent: Thursday, September 19, 2002 11:31 AM
To: fop-user@xml.apache.org
Subject: PDF from xml & XSL document objects ?
Hi,
I am trying to modify my existing java class, that can generate different
outputs.
Is there a way to generate PDF document with XML Document object and XSL
Document Object ? .
(The example that comes with FOP shows how to generate PDF document from
XML file and XSL file. But my requirement is not this.)
Thanks in advance,
Kalyan
----------------------------------------------------------------------------
--
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes