The paths to the images are not the problem. They are absolute paths to a lokal image file on the hard disk. But I think the other 2 possibilities are the cause of the problem. I didn't declare the xlink namespace. And one image I use has a cmyk colorspace.
I get the following exception while rendering:
sun.awt.image.ImageFormatException: Unsupported color conversion request
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at
sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144)
at
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:257
)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
I got the same exception with AWTRenderer, which I used for
a preview. So I tried to do the preview with SVG and
JSVGCanvas from Batik. But the problem with the images is
the same. (and I want to replace AWTRenderer with something
else because the font rendering quality is really bad).
I added my fo file and the produced svg file to this mail.
Maybe you can take a look at it, and hopefully tell me whats
wrong.
Don't bother about the $data.getXXX() functions in the fo file.
They come from Velocity which I use to fill my fo templates
with data.
Everything works fine with pdf creation but not with
svg output.
btw. svg creation is done with this function:
public void renderToSvg(byte []foFile, File file) {
try {
FileOutputStream outStream;
driver.setInputSource(new InputSource(new
ByteArrayInputStream(foFile)));
driver.setOutputStream(outStream = new
FileOutputStream(file));
driver.setRenderer(Driver.RENDER_SVG);
driver.run();
outStream.flush();
outStream.close();
}
catch (FileNotFoundException fnfex) {fnfex.printStackTrace();}
catch (IOException ioex) {ioex.printStackTrace();}
catch (FOPException fopex) {fopex.printStackTrace();}
}
Could be I forgot something here as well.
TIA Alex
-----Ursprungliche Nachricht-----
Von: J.Pietschmann [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 13. Marz 2003 00:11
An: [EMAIL PROTECTED]
Betreff: Re: xsl:fo to svg rendering with raster images
Alexander Koppelhuber wrote:
> I tried to render my fo files to svg, which works
> fine for text. But none of the external images
> makes it to the svg file. Batik can produce <image>
> tags with links to external images.
> Is this a limitation in fop?
> (producing a pdf with the same fo file works fine).
Most likely your images weren't found. Check whether
the source URLs would work with an fo:external-graphic.
You might need to use absolute URLs.
Other possiblities:
- The image file formats are not supported. I'm not sure
but perhaps installing Jimi (see FOP FAQ) helps with
this issue.
- You forgot to declare the xlink namespace.
A code sample would have helped in diagnosing the problem.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Document : Visitenkarte.fo.xml
Created on : 15. Februar 2003, 02:49
Author : Alexander Koppelhuber
Description:
Purpose of the document follows.
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="basic page"
page-height="55mm"
page-width="170mm"
margin-top="0cm"
margin-bottom="0cm"
margin-left="0mm"
margin-right="0mm">
<fo:region-body margin-top="0cm"
margin-right="0mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="basic page">
<fo:flow flow-name="xsl-region-body">
<!--<fo:block-container width="85mm" height="55mm" top="-1mm" position="absolute" >
<fo:block>
<fo:external-graphic src="url('$data.getBackground()')" width="85mm" height="55mm" scaling="uniform"/>
</fo:block>
</fo:block-container>
-->
<fo:block-container width="85mm" height="11mm" left="85mm" top="44mm" position="absolute" >
<fo:block>
<fo:external-graphic src="url('$data.getImage(0)')" width="85mm" height="11mm" scaling="uniform"/>
</fo:block>
</fo:block-container>
<fo:block-container width="31.16mm" height="45mm" left="85mm" top="-1mm" position="absolute" >
<fo:block>
<fo:external-graphic src="url('$data.getImage(1)')" width="31.16mm" height="45mm" scaling="uniform"/>
</fo:block>
</fo:block-container>
<!-- Name -->
<fo:block-container width="80mm" height="8mm" left="6mm" top="5mm" position="absolute">
<fo:block font-family="Frutiger66" font-size="15pt" white-space-collapse="false">$data.getText(0)</fo:block>
</fo:block-container>
<!-- Funktion -->
<fo:block-container width="80mm" height="10mm" left="6mm" top="11mm" position="absolute">
<fo:block font-family="Frutiger56" font-size="9pt" white-space-collapse="false">$data.getText(1)</fo:block>
</fo:block-container>
<!-- Anschrift -->
<fo:block-container width="52mm" height="40mm" left="118mm" top="4.3mm" position="absolute">
<fo:block font-family="Frutiger55Roman" line-height="140%" font-size="8pt" white-space-collapse="false">$data.getText(2)</fo:block>
</fo:block-container>
<!-- Name Bezirk -->
<fo:block-container width="78mm" height="3mm" left="90mm" top="50mm" position="absolute">
<fo:block font-family="Frutiger66" text-align="end" font-size="5pt" white-space-collapse="false">$data.getText(3)</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
<<attachment: VisitenkartenKlappInnen.svg.svg>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
