[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Trouble adding an image to FO

Subject: Re: Trouble adding an image to FO
From: "Glen Mazza" <grm7790@xxxxxxxxx>
Date: Tue, 25 May 2004 13:26:04 -0400
error while creating area
This looks like a common issue.  You may wish to ask on the FOP-USER list
for help, or search its archives.

Glen

----- Original Message ----- 
From: "Ian Lang" <ianplang@xxxxxxxxx>
To: "XSLT List" <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, May 25, 2004 1:02 PM
Subject:  Trouble adding an image to FO


> I am using FOP to generate a PDF.  The FO xml is
> coming from XSLT.  The trouble is I cannot seem to get
> images to show up correctly.  When I prototyped this
> from the command line and the xsl, FO and images were
> all in the same directory everything was cool but now
> that I have moved to code the images cannot be found
> by FOP.
>
> Origonally I was producing an FO element like this:
> <fo:external-graphic height="10pt" width="10pt"
> src="15272099.gif" />
>
> which yielded an error from FOP:
> [ERROR] Error while creating area : Error with image
> URL: 15272099.gif (The handle is invalid.
> ) and no base URL is specified
>
> The images, FO and output PDF are still in the same
> directory but it is not the current directory from the
> command line any more the rendering is being done in
> Java code.  So I did some experimenting and tried
> passing full paths like this:
> <fo:external-graphic height="10pt" width="10pt"
> src="C:\Temp\Report/8390677.gif" />
>
> which yielded an error from FOP:
> [ERROR] Error in XObject : Error while loading image
> file:C:/Temp/Report/8390677.gif : class
> java.lang.ClassCastException -
> java/io/BufferedInputStream incompatible with
> java/awt/image/ImageProducer
>
> I also tried file: URL formats which did not help.
> Then after doing some digging I found reference to an
> FO function 'url()'.  I tried that with XSL like this:
> <xsl:variable name="iconFullPath">
>   <xsl:value-of select="concat('url(&quot;',
> $outputDir, $fileSep, @publish:icon, '&quot;)')"/>
> </xsl:variable>
> <xsl:message>
>   <xsl:value-of select="$newLine"/>
>   <xsl:text>Adding a graphic to the FO XML.  The icon
> attribute is '</xsl:text>
>   <xsl:value-of select="@publish:icon"/>
>   <xsl:text>' and the full uri is '</xsl:text>
>   <xsl:value-of select="$iconFullPath"/>
>   <xsl:text>'.</xsl:text>
> </xsl:message>
>
> <fo:block font-size="12pt" line-height="15pt"
> start-indent="0.5cm">
>   <fo:external-graphic width="10pt" height="10pt">
>     <xsl:attribute name="src"><xsl:value-of
> select="$iconFullPath"/></xsl:attribute>
>   </fo:external-graphic>
>   <xsl:value-of select="@publish:qualifiedname"/>
> </fo:block>
>
> Which creates these FO elements:
> <fo:block start-indent="0.5cm" line-height="15pt"
> font-size="12pt">
>   <fo:external-graphic height="10pt" width="10pt"
> src="url("C:\Temp\Report/8390677.gif")" />
>   an.element.qualifed.name
> </fo:block>
>
> Which produced xsl:message entry:
> Adding a graphic to the FO XML.  The icon attribute is
> '8390677.gif' and the full uri is
> 'url("C:\Temp\Report/8390677.gif")'.; SystemID:<snip>
>
> And this error from FOP
> [ERROR] Error in XObject : Error while loading image
> file:C:/Temp/Report/8390677.gif : class
> java.lang.ClassCastException -
> java/io/BufferedInputStream incompatible with
> java/awt/image/ImageProducer
>
> Further digging around the internet yielded no other
> ideas.  Any help, inspiration would be appreciated.
>
> Thanks,
>
> IL
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.