Problem with fo:external-graphic
Here should go questions about transforming XML with XSLT and FOP.
Problem with fo:external-graphic
Hi,
I would like to insert an image in a PDF file with Fop 0.92.
i try this
<fo:block>
<fo:external-graphic src="logo.jpg"/>
</fo:block>
But i have this error :
May 18, 2006 11:38:00 AM org.apache.fop.fo.flow.ExternalGraphic bind
SEVERE: Image not available: logo.jpg
But the image is in the same folder as the xml and xsl file i use to create the PDF file.
Can someone help me ?
I try to have a look at fop.xconf to set basedir but i don't think that this file is read.
Where i have to place it ?
Thanks in advance.
Imhotep
I would like to insert an image in a PDF file with Fop 0.92.
i try this
<fo:block>
<fo:external-graphic src="logo.jpg"/>
</fo:block>
But i have this error :
May 18, 2006 11:38:00 AM org.apache.fop.fo.flow.ExternalGraphic bind
SEVERE: Image not available: logo.jpg
But the image is in the same folder as the xml and xsl file i use to create the PDF file.
Can someone help me ?
I try to have a look at fop.xconf to set basedir but i don't think that this file is read.
Where i have to place it ?
Thanks in advance.
Imhotep
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
Probably the logo.jpg file is not in the same folder as the XSL-FO file. Try the following example and make sure you copy the logo.jpg file in the same folder as the XSL-FO file and that it contains a JPEG image:
When I apply FOP to this file I get a PDF file containing the JPEG image. I do not use the fop.xconf file (after I removed it the PDF file is generated correctly).
Regards,
Sorin
Probably the logo.jpg file is not in the same folder as the XSL-FO file. Try the following example and make sure you copy the logo.jpg file in the same folder as the XSL-FO file and that it contains a JPEG image:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<fo:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:external-graphic src="logo.jpg"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
I obtained the PDF by running FOP at the command line in the FOP install folder:
I got the same result by applying FOP to the same FO file in <oXygen/>. If the above sample file does not work for you then the file path of the FO file must be set when the FOP servlet is called but I think this is a Tomcat question.
I hope that helps,
Sorin
I obtained the PDF by running FOP at the command line in the FOP install folder:
Code: Select all
fop.bat -fo test.fo -pdf test.pdf
I hope that helps,
Sorin
It's works using the command line fop.bat .........
but using the servlet there is a classpath problem.
Indeed the url is :
http://localhost:8080/fop?fo=c:/temp/testimage.fo
the image logo.jpg is in the same folder, but i think that fop servlet doesn't know where.
Is there is a instruction to identify the classpath ?
Thanks in advance.
Imhotep
but using the servlet there is a classpath problem.
Indeed the url is :
http://localhost:8080/fop?fo=c:/temp/testimage.fo
the image logo.jpg is in the same folder, but i think that fop servlet doesn't know where.
Is there is a instruction to identify the classpath ?
Thanks in advance.
Imhotep
No, but you can get the current classloader and if it is an URLClassLoader then you may get the URLs it looks into, then you can get its parent and do the same until you get a null parent. This might give you information about what it is accessible through the classloaders at that point.Is there is a instruction to identify the classpath ?
Best Regards,
George
Problem loading images in PDF with FOP
Hi,
I want to include a GIF into a PDF, which is there in Websever location (/nova/global/images).
Following bits of code is implemented on both webpshere 5.0.1 and 6.0.0.1, images are displaying in webpshere 5.0.1 and but not in webpshere 6.0.0.1. I am using fop 0.20.5, cocoon 2.1, Xalan 2.5.1 and Xerces 2.4.0
<fo:block text-align="right" font-weight="bold" padding="10pt">
<fo:external-graphic src="url('{$domain}/nova/global/images/nissan-logo.gif')" />
</fo:block>
and
<fo:external-graphic>
<xsl:attribute name="src">url('<xsl:value-of select="$domain"/><xsl:value-of select="/page/generic/NSC-MODEL-XTND/NSC-MODEL-XTND-EBROCHURE-IMAGE" />')</xsl:attribute>
</fo:external-graphic>
and
<fo:external-graphic src="http://preprodweb1.xxxxx.co.uk/nova/glo ... n-logo.gif"/>
In the above code, value of domain is comming from XML (value is http://prepodweb1.xxxxx.co.uk) and value for /page/generic/NSC-MODEL-XTND/NSC-MODEL-XTND-EBROCHURE-IMAGE is /Media-Library/vehicles/e-brochure/br-micramc2005.jpg
Also implemented the suggestion, which I found in google search.
1) src="logo.jpg"
2) src="file:./logo.jpg"
3) src="file://./logo.jpg"
4) src="url('imagesrc')"
Is there any issue with Webpshere 6.0.0.1.
It would be extremely helpful for any suggestions.
Thanks & Regards,
Deva
I want to include a GIF into a PDF, which is there in Websever location (/nova/global/images).
Following bits of code is implemented on both webpshere 5.0.1 and 6.0.0.1, images are displaying in webpshere 5.0.1 and but not in webpshere 6.0.0.1. I am using fop 0.20.5, cocoon 2.1, Xalan 2.5.1 and Xerces 2.4.0
<fo:block text-align="right" font-weight="bold" padding="10pt">
<fo:external-graphic src="url('{$domain}/nova/global/images/nissan-logo.gif')" />
</fo:block>
and
<fo:external-graphic>
<xsl:attribute name="src">url('<xsl:value-of select="$domain"/><xsl:value-of select="/page/generic/NSC-MODEL-XTND/NSC-MODEL-XTND-EBROCHURE-IMAGE" />')</xsl:attribute>
</fo:external-graphic>
and
<fo:external-graphic src="http://preprodweb1.xxxxx.co.uk/nova/glo ... n-logo.gif"/>
In the above code, value of domain is comming from XML (value is http://prepodweb1.xxxxx.co.uk) and value for /page/generic/NSC-MODEL-XTND/NSC-MODEL-XTND-EBROCHURE-IMAGE is /Media-Library/vehicles/e-brochure/br-micramc2005.jpg
Also implemented the suggestion, which I found in google search.
1) src="logo.jpg"
2) src="file:./logo.jpg"
3) src="file://./logo.jpg"
4) src="url('imagesrc')"
Is there any issue with Webpshere 6.0.0.1.
It would be extremely helpful for any suggestions.
Thanks & Regards,
Deva
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service