FOP with WO error
FOP with WO error
- Subject: FOP with WO error
- From: Wolfram Stebel <email@hidden>
- Date: Wed, 09 Mar 2005 21:57:40 +0100
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
_______________________________________________
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