W3C home > Mailing lists > Public > www-xsl-fo@w3.org > February 2010

RE: Re: Image not available

From: Paulo Carvalho <pjcarvalho@gmail.com>
Date: Wed, 17 Feb 2010 09:59:59 +0100
Message-ID: <8f151cff1002170059r73d0add3i94af6e05dea0ce98@mail.gmail.com>
To: www-xsl-fo@w3.org
Hello
Maybe I have a clue.

(Just to remind, my web service use FO to transform a XML into a PDF)

In the XML to FO transformation step, I logged the FO generated. In the part
where the image should appear the text is the following one:

<fo:table-cell padding="0" text-align="left" display-align="center">
  <fo:block>
    <fo:external-graphic src="url(img/logo.gif)"/>
  </fo:block>
</fo:table-cell>

But it should be something like this no?

<fo:table-cell padding="0" text-align="left" display-align="center">
  <fo:block>
    <fo:external-graphic src="url(
jar:file:/D:/Programs/apache-tomcat-6.0.24/webapps/MyWS/WEB-INF/lib/App.jar!/img/logo.gif
)"/>
  </fo:block>
</fo:table-cell>

"jar:file:/D:/Programs/apache-tomcat-6.0.24/webapps/MyWS/WEB-INF/lib/App.jar!/"
is the string used as SystemID for the streamsource used in the FO
transformation... (string subs2 in the following code)


String sss =
this.getClass().getClassLoader().getResource("img/cnpf.gif").toExternalForm();
int idxl = sss.lastIndexOf("/");
String subs1 = sss.substring(0, idxl);
int idxl2 = subs1.lastIndexOf("/");
String subs2 = subs1.substring(0, idxl2+1);
streamSource.setSystemId(subs2);
Transformer foTrans = tFactoryXML2FO.newTransformer(streamSource);



Re: Image not available

   - This message: [ Message
body<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0029.html#start29>
]
   [ Respond<www-xsl-fo@w3.org?Subject=Re%3A%20Image%20not%20available&In-Reply-To=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E&References=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E>
]
   [ More options<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0029.html#options3>
    ]
   - Related messages: [ Previous
message<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0028.html>
]
   [ In reply to<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0026.html>
    ]

From: Jeremias Maerki
<dev@jeremias-maerki.ch<dev@jeremias-maerki.ch?Subject=Re%3A%20Image%20not%20available&In-Reply-To=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E&References=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E>
>
Date: Wed, 17 Feb 2010 09:32:45 +0100
To: www-xsl-fo@w3.org<www-xsl-fo@w3.org?Subject=Re%3A%20Image%20not%20available&In-Reply-To=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E&References=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E>

Message-Id: <20100217093120.3210.60BA733C@jeremias-maerki.ch>

Just verified the following with Apache FOP 0.95:
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Hello World!</fo:block>
      <fo:block><fo:external-graphic
src="jar:file:///C:/Dev/FOP/main/trunk-clean/build/fop.jar!/org/apache/fop/render/awt/viewer/images/fop.gif"/></fo:block>
    </fo:flow>

Worked fine for me. So JAR URLs should work in principle.

On 17.02.2010 09:11:14 Paulo Carvalho wrote:
> Hello again
>
> Just for info, I was using fop093 and I switched to fop095, but without any
> improvements.
> The application still cant find the image...
>
> Thanks
> Regards
>
> On Mon, Feb 15, 2010 at 3:01 PM, Paulo Carvalho <pjcarvalho@gmail.com <pjcarvalho@gmail.com?Subject=Re%3A%20Image%20not%20available&In-Reply-To=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E&References=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E>>wrote:
>
> > Hello
> >
> > I have a web service that uses a jar application file (that i built). This
> > application jar file transforms a XML into a PDF using FOP. The XML file as
> > some text and also the path/name of an image file that is also into the jar
> > file.
> >
> > When i execute the web service, using eclipse/tomcat deployment, everything
> > is executed ok. The PDF is well generated and the image (the header of the
> > pdf file) is correctly on the pdf document.
> >
> > Now, I build a WAR file to deploy my web service on a server. The WAR
> > contains correctly the JAR file with the image file.
> > When i deploy the WAR file without eclipse, using only the classical
> > command line and I test it, the PDF is generated correctly but without the
> > image that constitues is header. The following error :
> >    "2010-02-15 14:27:29,267 ERROR org.apache.fop.fo.FONode -
> > ExternalGraphic.java:70 - Image not available: url(img\\head.gif)" is
> > generated
> >
> > Is it a problem of FOP? Can you please help me to resolve this problem?
> >
> > thanks
> >
> > Best regards
> >
> > --
> > Paulo Carvalho
> > 1 rue du Chateau
> > 57710 Aumetz
> > France
> > http://forum-informatico.forumeiros.com/index.htm
> > http://ummundoecologico.blogspot.com
> >
>
>
>
> --
> Paulo Carvalho
> 1 rue du Chateau
> 57710 Aumetz
> France
> http://forum-informatico.forumeiros.com/index.htm
> http://ummundoecologico.blogspot.com




Jeremias Maerki

Received on Wednesday, 17 February 2010 08:33:16 GMT

   - This message: [ Message
body<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0029.html#start29>
    ]
   - Previous message: Paulo Carvalho: "Re: Re: Image not
available"<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0028.html>
   - In reply to: Paulo Carvalho: "Re: Re: Image not
available"<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0026.html>


   - Mail actions: [ respond to this
message<www-xsl-fo@w3.org?Subject=Re%3A%20Image%20not%20available&In-Reply-To=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E&References=%253C20100217093120.3210.60BA733C%40jeremias-maerki.ch%253E>
]
   [ mail a new topic <www-xsl-fo@w3.org> ]
   - Contemporary messages sorted: [ by
date<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/index.html#msg29>
]
   [ by thread<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/thread.html#msg29>
]
   [ by subject<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/subject.html#msg29>
]
   [ by author<http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/author.html#msg29>
    ]
   - Help: [ How to use the archives <http://lists.w3.org/Help/> ] [ Search
   in the archives<http://www.w3.org/Search/Mail/Public/search?type-index=www-xsl-fo&index-type=t>
    ]

*This archive was generated by hypermail
2.2.0<http://www.hypermail-project.org/>
+W3C-0.50 <http://www.w3.org/2004/12/hypermail-w3c-patch/> : Wednesday, 17
February 2010 08:33:16 GMT*

-- 
Paulo Carvalho
1 rue du Chateau
57710 Aumetz
France
http://forum-informatico.forumeiros.com/index.htm
http://ummundoecologico.blogspot.com
Received on Wednesday, 17 February 2010 09:00:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 17 February 2010 09:00:35 GMT