- From: Olaf Wentzien <olaf.wentzien@ppi.de>
- Date: Tue, 16 Feb 2010 13:47:33 +0100
- To: www-xsl-fo@w3.org
- Message-ID: <OF05733CC9.72511AB0-ONC12576CC.0045DF12-C12576CC.0046466E@ppi.de>
Hi Paolo, I think the problem is, that the setSysemId-Method should only get the directory from where on the image has to be searched. So it should be only : file:/D:/Programs/apache-tomcat-6.0.24/webapps/MyWS/WEB-INF/lib/App.jar!/ from that point img/logo.gif is searched Hope that works / Olaf > > Olaf, > > I tried with the solution you proposed (I have put the image name > hardcoded on my java class) but the result were the same: the image > as not been found. > > I have put some log messages to control what was happening. Here they are: > > [DEBUG] imagePath: file:/D:/Programs/apache-tomcat-6.0.24/webapps/ > MyWS/WEB-INF/lib/App.jar!/img/logo.gif > [ERROR] Image not available: url(img/logo.gif) > > In the first list, you can see that mee image is on the img path > into the App.jar file. The App.jar file is in the WAR file on my web service. > > Here is the coded I used: > > StreamSource streamSource = new StreamSource(tu.getxFile().getInputStream()); > String imagePath = this.getClass().getClassLoader().getResource > ("img/logo.gif").getPath(); > LOGGER..debug("imagePath: " + imagePath); > streamSource.setSystemId(imagePath); > Transformer foTrans = tFactoryXML2FO.newTransformer(streamSource); > Transformer pdfTrans = tFactoryFO2PDF.newTransformer(); > > Thank you for your help > > From: Paulo Carvalho <pjcarvalho@gmail.com> > Date: Tue, 16 Feb 2010 11:05:30 +0100 > Message-ID: <8f151cff1002160205n80263fen8f95bbca9cd8ca8b@mail.gmail.com> > To: www-xsl-fo@w3.org > > Thanks for your answer. > > Its indead a solution but the problem is that I dont know the name of my > image file. The name of the image file is on the XSL file like this: > <xsl:value-of select="string('img/logo.gif')"/> > > But I will try to figure out if it is possible to resolve the problem using > this approach... > > Regards > > From: Olaf Wentzien > <olaf.wentzien@ppi.de<olaf.wentzien@ppi.de?Subject=RE%3A%3A%20RE%3A% > 20Image%20not%20available&In-Reply-To=%253COFBD287B26.3E54E39A- > ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E&References=% > 253COFBD287B26.3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E> > > > Date: Tue, 16 Feb 2010 10:29:31 +0100 > To: www-xsl-fo@w3.org<www-xsl-fo@w3.org?Subject=RE%3A%3A%20RE%3A% > 20Image%20not%20available&In-Reply-To=%253COFBD287B26.3E54E39A- > ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E&References=% > 253COFBD287B26.3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E> > > Message-ID: < > OFBD287B26.3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9@ppi.de> > > Hi , > > how about something like that: > > > ..... > StreamSource streamSource = new StreamSource > (tu.getxFile().getInputStream()); > String imagePath = this.getClass().getClassLoader().getResource( > "your-image-file").getPath(); > streamSource.setSystemId(imagePath); > > Transformer foTrans = tFactoryXML2FO.newTransformer(streamSource); > Transformer pdfTrans = tFactoryFO2PDF.newTransformer(); > ..... > > > > > > Hello Olaf > > > > Thanks for your answer. The problem is that my XSL comes from a > > table on a database, so it is not in the jar file. I get it from the > > DB into a byte[] and gets a StreamSource from it... > > > > ... > > Transformer foTrans = tFactoryXML2FO.newTransformer(new StreamSource > > (tu.getxFile().getInputStream())); > > Transformer pdfTrans = tFactoryFO2PDF.newTransformer(); > > ... > > > > Any other idea? > > > > Thanks > > > > best regards > > > > From: Olaf Wentzien <olaf.wentzien@ppi.de <olaf.wentzien@ppi.de? > Subject=RE%3A%3A%20RE%3A%20Image%20not%20available&In-Reply-To=% > 253COFBD287B26..3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de > %253E&References=%253COFBD287B26.3E54E39A-ONC12576CC.0032A934- > C12576CC.003424C9%40ppi.de%253E>> > > Date: Mon, 15 Feb 2010 17:35:43 +0100 > > To: www-xsl-fo@w3.org <www-xsl-fo@w3.org?Subject=RE%3A%3A%20RE%3A% > 20Image%20not%20available&In-Reply-To=%253COFBD287B26.3E54E39A- > ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E&References=% > 253COFBD287B26.3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%253E> > > Message-ID: > <OFBE28BA44.3FE0A418-ONC12576CB..005A440C-C12576CB.005B2966@ppi.de > <OFBE28BA44.3FE0A418-ONC12576CB..005A440C-C12576CB.005B2966@ppi.de? > Subject=RE%3A%3A%20RE%3A%20Image%20not%20available&In-Reply-To=% > 253COFBD287B26..3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de > %253E&References=%253COFBD287B26.3E54E39A-ONC12576CC.0032A934- > C12576CC.003424C9%40ppi.de%253E> > > > > > > > Hi, > > > > I guess you have to tell FOP - before calling the rendering process - > from > > wich point it shall resolve filenames. > > > > try doing this with: > > > > xslSource.setSystemId(xslUrl.toExternalForm()); > > > > > > where xslSource is the XML-Input file and > > xslUrl is the style-sheet-file - assuming that your stylesheet is in the > > > same jar-file as your image and that is has a location from where you > can > > find your image using a relative path > > > > > > Regards Olaf > > > > > > > > > > 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 > > Received on Tuesday, 16 February 2010 09:30:06 GMT > > - This message: [ Message > body< http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0019.html#start19> > ] > - Previous message: Paulo Carvalho: "RE: Image not > available"< http://lists.w3.org/Archives/Public/www-xsl-fo/2010Feb/0018.html> > - In reply to: [ message archived in another list or > period<http://www.w3.org/mid/E1NhHlD-0003Bz-CE@frink.w3..org> > ] > > > - Mail actions: [ respond to this > message<www-xsl-fo@w3.org?Subject=RE%3A%3A%20RE%3A%20Image%20not% > 20available&In-Reply-To=%253COFBD287B26.3E54E39A-ONC12576CC. > 0032A934-C12576CC.003424C9%40ppi.de%253E&References=%253COFBD287B26. > 3E54E39A-ONC12576CC.0032A934-C12576CC.003424C9%40ppi.de%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#msg19> > ] > [ by thread<http://lists.w3.org/Archives/Public/www-xsl-fo/ > 2010Feb/thread.html#msg19> > ] > [ by subject<http://lists.w3.org/Archives/Public/www-xsl-fo/ > 2010Feb/subject.html#msg19> > ] > [ by author<http://lists.w3.org/Archives/Public/www-xsl-fo/ > 2010Feb/author.html#msg19> > ] > - 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> > ] > > > -- > Paulo Carvalho > 1 rue du Chateau > 57710 Aumetz > France > http://forum-informatico.forumeiros.com/index.htm > http://ummundoecologico.blogspot.com > Received on Tuesday, 16 February 2010 10:14:41 GMT > > -- > Paulo Carvalho > 1 rue du Chateau > 57710 Aumetz > France > http://forum-informatico.forumeiros.com/index.htm > http://ummundoecologico.blogspot.com
Received on Tuesday, 16 February 2010 12:48:08 UTC