You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robert Sösemann <ro...@gmx.de> on 2002/12/03 17:21:08 UTC

dynamic xsl:fo image inclusion

I tried every tip I could find on the web, but I never had success including
an jpg into an pdf with cocoon.
Maybe sombody can help?

Thats what I have:

XSL:FO fragment transforming IMG tags:

   <xsl:template match="IMG">
        <fo:inline>
            <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
        </fo:inline>
   </xsl:template>

MYPATHPATH is changed to the real cocoon base path before serializing. So
the serializer should request the image in a correct way, that it is caugth
by this sitemap matcher:

            <map:match pattern="**.jpg">
                <map:read mime-type="image/jpg" src="resources/{1}.jpg"/>
            </map:match>

Why do I never get to see an image in my pdf`?


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Robert Sösemann wrote:
>    <xsl:template match="IMG">
>         <fo:inline>
>             <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
>         </fo:inline>
>    </xsl:template>

FOP does not use Cocoons source resolver for finding images.
Your best bet is to use either absolute file URLs:
   <fo:external-graphic src="file:///abs/path/to/{$src}"/>
or use a localhost http URL and set up a pipeline for Cocoon to
deliver them. Not exactly the fastest or most secure way (your
images are publicly accessible, unless you restrict access in
the web server to localhost)
   <fo:external-graphic src="http://localhost/cocoon/fop-img/{$src}"/>
BTW using images inline will not cause line height to be adjusted
or something, check before that your result looks ok.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Joerg Heinicke wrote:
> With
> 
> <fo:external-graphic height="16cm" src="../img/01.jpg"/>
> 
> I get at least following error message in the error.log:
> 
> ERROR   (2002-12-03) 23:06.40:484   [sitemap] (/cocoon/joerg/kal) 
> Thread-7/ExternalGraphic: Error while creating area : Error with image 
> URL: ..\img\01.jpg (Das System kann den angegebenen Pfad nicht finden) 
> and no base directory is specified
> 
> (Cocoon 2.1.dev, JDK 1.4.1, FOP 0.20.4)

I get something like "cannot set logger for fo2pdf component" with
a somewhat patched C2.0.2 and a FOP 0.20.5cvs. Maybe I should try
C2.1 again.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by Joerg Heinicke <jo...@gmx.de>.
With

<fo:external-graphic height="16cm" src="../img/01.jpg"/>

I get at least following error message in the error.log:

ERROR   (2002-12-03) 23:06.40:484   [sitemap] (/cocoon/joerg/kal) 
Thread-7/ExternalGraphic: Error while creating area : Error with image 
URL: ..\img\01.jpg (Das System kann den angegebenen Pfad nicht finden) 
and no base directory is specified

(Cocoon 2.1.dev, JDK 1.4.1, FOP 0.20.4)

Joerg

J.Pietschmann wrote:
> Joerg Heinicke wrote:
> 
>> Have a look into the log files (something like FileNotFoundException) 
>> and look, how the path is resolved.
> 
> FO image source URLs are not resolved and leave no trace in the logs.
> It may be necessary to look into the stdout/stderr for the FOP error
> message.
> 
> J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Joerg Heinicke wrote:
> Have a look into the log files (something like FileNotFoundException) 
> and look, how the path is resolved.
FO image source URLs are not resolved and leave no trace in the logs.
It may be necessary to look into the stdout/stderr for the FOP error
message.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by Joerg Heinicke <jo...@gmx.de>.
Have a look into the log files (something like FileNotFoundException) 
and look, how the path is resolved. Furthermore is it possible to look 
at the XSL FO after MYPATHBASE is evaluated?

Joerg

Robert Sösemann wrote:
> My image was also very small. This could not be the reason. Maybe you could
> send me some of your code snippets.
> 
> Robert
> ----- Original Message -----
> From: "Ludovic de Beaurepaire" <lu...@axonie.com>
> To: <co...@xml.apache.org>
> Sent: Tuesday, December 03, 2002 5:51 PM
> Subject: Re: dynamic xsl:fo image inclusion
> 
> 
> 
>>Hi robert,
>>
>>I solved this problem this afternoon :-) there were no error message in
> 
> the
> 
>>logs, and the cause was a too large image. try with a small jpg.
>>
>>Regards,
>>
>>Ludovic
>>----- Original Message -----
>>From: "Robert Sösemann" <ro...@gmx.de>
>>To: <co...@xml.apache.org>
>>Sent: Tuesday, December 03, 2002 5:21 PM
>>Subject: dynamic xsl:fo image inclusion
>>
>>
>>
>>>I tried every tip I could find on the web, but I never had success
>>
>>including
>>
>>>an jpg into an pdf with cocoon.
>>>Maybe sombody can help?
>>>
>>>Thats what I have:
>>>
>>>XSL:FO fragment transforming IMG tags:
>>>
>>>   <xsl:template match="IMG">
>>>        <fo:inline>
>>>            <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
>>>        </fo:inline>
>>>   </xsl:template>
>>>
>>>MYPATHPATH is changed to the real cocoon base path before serializing.
> 
> So
> 
>>>the serializer should request the image in a correct way, that it is
>>
>>caugth
>>
>>>by this sitemap matcher:
>>>
>>>            <map:match pattern="**.jpg">
>>>                <map:read mime-type="image/jpg"
> 
> src="resources/{1}.jpg"/>
> 
>>>            </map:match>
>>>
>>>Why do I never get to see an image in my pdf`?


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
Hi Robert,

 <xsl:variable name="imagedir"
select="'file:C:\\axonie\clients\Infolis\work\jakarta-tomcat-4.1.12\webapps\
cocoon\samples\srvimp\style\xsl\images\'"/>
 <xsl:variable name="graphUrl"
select="'http://localhost:8080/cocoon/samples/srvimp/svg/'"/>

these 2 lines are the xsl variables i use to prefix my filenames, it works
on my machine.

<xsl:variable name="cbpath" select="concat($graphUrl,$cbname)"/>
<fo:external-graphic src="{$cbpath}"/>

Ludovic

----- Original Message -----
From: "Robert Sösemann" <ro...@gmx.de>
To: <co...@xml.apache.org>
Sent: Tuesday, December 03, 2002 10:19 PM
Subject: Re: dynamic xsl:fo image inclusion


> My image was also very small. This could not be the reason. Maybe you
could
> send me some of your code snippets.
>
> Robert
> ----- Original Message -----
> From: "Ludovic de Beaurepaire" <lu...@axonie.com>
> To: <co...@xml.apache.org>
> Sent: Tuesday, December 03, 2002 5:51 PM
> Subject: Re: dynamic xsl:fo image inclusion
>
>
> > Hi robert,
> >
> > I solved this problem this afternoon :-) there were no error message in
> the
> > logs, and the cause was a too large image. try with a small jpg.
> >
> > Regards,
> >
> > Ludovic
> > ----- Original Message -----
> > From: "Robert Sösemann" <ro...@gmx.de>
> > To: <co...@xml.apache.org>
> > Sent: Tuesday, December 03, 2002 5:21 PM
> > Subject: dynamic xsl:fo image inclusion
> >
> >
> > > I tried every tip I could find on the web, but I never had success
> > including
> > > an jpg into an pdf with cocoon.
> > > Maybe sombody can help?
> > >
> > > Thats what I have:
> > >
> > > XSL:FO fragment transforming IMG tags:
> > >
> > >    <xsl:template match="IMG">
> > >         <fo:inline>
> > >             <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
> > >         </fo:inline>
> > >    </xsl:template>
> > >
> > > MYPATHPATH is changed to the real cocoon base path before serializing.
> So
> > > the serializer should request the image in a correct way, that it is
> > caugth
> > > by this sitemap matcher:
> > >
> > >             <map:match pattern="**.jpg">
> > >                 <map:read mime-type="image/jpg"
> src="resources/{1}.jpg"/>
> > >             </map:match>
> > >
> > > Why do I never get to see an image in my pdf`?
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question  has not already been answered in the
> > > FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> > >
> > > To unsubscribe, e-mail:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question  has not already been answered in the
> > FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by Robert Sösemann <ro...@gmx.de>.
My image was also very small. This could not be the reason. Maybe you could
send me some of your code snippets.

Robert
----- Original Message -----
From: "Ludovic de Beaurepaire" <lu...@axonie.com>
To: <co...@xml.apache.org>
Sent: Tuesday, December 03, 2002 5:51 PM
Subject: Re: dynamic xsl:fo image inclusion


> Hi robert,
>
> I solved this problem this afternoon :-) there were no error message in
the
> logs, and the cause was a too large image. try with a small jpg.
>
> Regards,
>
> Ludovic
> ----- Original Message -----
> From: "Robert Sösemann" <ro...@gmx.de>
> To: <co...@xml.apache.org>
> Sent: Tuesday, December 03, 2002 5:21 PM
> Subject: dynamic xsl:fo image inclusion
>
>
> > I tried every tip I could find on the web, but I never had success
> including
> > an jpg into an pdf with cocoon.
> > Maybe sombody can help?
> >
> > Thats what I have:
> >
> > XSL:FO fragment transforming IMG tags:
> >
> >    <xsl:template match="IMG">
> >         <fo:inline>
> >             <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
> >         </fo:inline>
> >    </xsl:template>
> >
> > MYPATHPATH is changed to the real cocoon base path before serializing.
So
> > the serializer should request the image in a correct way, that it is
> caugth
> > by this sitemap matcher:
> >
> >             <map:match pattern="**.jpg">
> >                 <map:read mime-type="image/jpg"
src="resources/{1}.jpg"/>
> >             </map:match>
> >
> > Why do I never get to see an image in my pdf`?
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question  has not already been answered in the
> > FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: dynamic xsl:fo image inclusion

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
Hi robert,

I solved this problem this afternoon :-) there were no error message in the
logs, and the cause was a too large image. try with a small jpg.

Regards,

Ludovic
----- Original Message -----
From: "Robert Sösemann" <ro...@gmx.de>
To: <co...@xml.apache.org>
Sent: Tuesday, December 03, 2002 5:21 PM
Subject: dynamic xsl:fo image inclusion


> I tried every tip I could find on the web, but I never had success
including
> an jpg into an pdf with cocoon.
> Maybe sombody can help?
>
> Thats what I have:
>
> XSL:FO fragment transforming IMG tags:
>
>    <xsl:template match="IMG">
>         <fo:inline>
>             <fo:external-graphic src="url(MYPATHBASE/{$src})"/>
>         </fo:inline>
>    </xsl:template>
>
> MYPATHPATH is changed to the real cocoon base path before serializing. So
> the serializer should request the image in a correct way, that it is
caugth
> by this sitemap matcher:
>
>             <map:match pattern="**.jpg">
>                 <map:read mime-type="image/jpg" src="resources/{1}.jpg"/>
>             </map:match>
>
> Why do I never get to see an image in my pdf`?
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>