Hi Franz,
Do the width and height variables in your code snippet have values?
I don't see the display.width and display.height variables being passed
to your stylesheet when you execute fop from the command line. To do
this use the "-param" argument.
try :-
fop.bat -c userconfig.xml -xml data\data.xml -xsl FOP_Stylesheet.xsl
-param display.width #1 -param display.height #2 -png
Replacing #1 and #2 with your width and height values that you used in
your code snippet.
Also - this may sound obvious, but do you have more than one different
installation of FOP on your machine? If so double check that your
command line path tallies with your java classpath.
Adrian.
fma-001 wrote:
Hi!
When I create an image through command line (CLI) the png looks perfect. But
when I embed FOP into Java it's a bit hazy.
Here the outputfile of CLI:
http://www.nabble.com/file/p11285163/data_krank.png
Here the outputfile of Java embedded:
http://www.nabble.com/file/p11285163/portal.png
I started FOP from command line as following:
fop.bat -c userconfig.xml -xml data\data.xml -xsl FOP_Stylesheet.xsl -png
data.png
The Java snippets looks like that:
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Fop fop = null;
fop = fopFactory.newFop(MimeConstants.MIME_PNG, foUserAgent, outputStream);
// Setup XSLT
TransformerFactory factory = TransformerFactory.newInstance();
SAXSource xsltSource = new SAXSource(new
InputSource(Thread.currentThread().getContextClassLoader().getResourceAsStream("com/xt/icee/rendering/resource/FOP_Stylesheet.xsl")));
Transformer transformer = factory.newTransformer(xsltSource);
// Set the value of a <param> in the stylesheet
transformer.setParameter("versionParam", "2.0");
if (width != -1) {
transformer.setParameter("display.width",
String.valueOf(width));
}
if (height != -1) {
transformer.setParameter("display.height",
String.valueOf(height));
}
// Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(xmlSource, res);
Does anyone have a clue why the two results are different?
Thanks in advance!
Franz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]