Re: FOP with WO error
Re: FOP with WO error
- Subject: Re: FOP with WO error
- From: Lawrence Kendall <email@hidden>
- Date: Thu, 10 Mar 2005 20:31:53 +1100
Hi Wolfram,
I have had a similar issue where my PDF crashes Preview. Usually it is
a result of having the xml formatted badly, say, having a fo:table-row
as a child of fo:table-cell etc.
However, when I copied your xml into my app it worked fine first time.
It generated an 8kb file which displayed fine.
I'd say that your issue is in your FO2PDFSerializer. Either that or
your libraries are out of date or something. I remember a while back I
had to update all my Batik libraries because I needed some new feature
that wasn't available in the old ones. I had a quick look through my
bookmarks but couldn't see where I got them from.
Sorry I couldn't be any more help, but you rest assured that your xml
is good.
Larry.
~~~~~~~~~~~~~~~~~~~
On 10/03/2005, at 10:50 AM, email@hidden
wrote:
Message: 7
Date: Wed, 09 Mar 2005 21:57:40 +0100
From: Wolfram Stebel <email@hidden>
Subject: FOP with WO error
To: WebObjects-List Apple <email@hidden>
Message-ID: <BE5521D4.4A74%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
Hi all,
i try a very simple fop sample to run with WO where the xml is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm"
page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm"
margin-right="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hello World!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
I use the code from ravi mendis FO2PDFSerializer, where the essence is:
public void appendToResponse ( WOResponse response, WOContext
context )
{
super.appendToResponse ( response, context );
// parse FO tree
Document document = response.contentAsDOMDocument();
ByteArrayOutputStream out = new ByteArrayOutputStream();
Logger log = new ConsoleLogger ( ConsoleLogger.LEVEL_INFO );
Driver driver = new Driver();
driver.setLogger ( log );
MessageHandler.setScreenLogger ( log );
driver.setRenderer ( Driver.RENDER_PDF );
driver.setOutputStream ( out );
log.debug ( "Testlog" ); // geht nicht wegen Level?
// render to PDF
try
{
driver.render ( document );
}
catch ( Exception exception )
{
NSLog.err.appendln("PDF: render: " + exception);
}
// set the PDF content and header
response.setContent ( new NSData ( out.toByteArray() ) );
response.setHeader ( "application/pdf", "Content-Type" );
}
This is the error reported from the catch above:
[ERROR] Unsupported element encountered: null (Namespace: null). Source
context: unavailable
[ERROR] Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect,
etc.)
or elements from another supported language.
It writes 15 Bytes (should be more) to the file and crashes when opening
with "Preview".
Who knows what is wrong?
Does anybody have a working sample code?
Wolfram
------------------------------------
Larry
When confronted by a difficult problem, you can solve it more easily by
reducing it to the question, "How would the Lone Ranger handle this?"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden