Bug 491782

Summary: .xml and images in sub-directories break images in PDF
Product: [Community] Publican Reporter: Darrin Mison <dmison>
Component: publicanAssignee: Ruediger Landmann <rlandman>
Status: CLOSED CURRENTRELEASE QA Contact: Joshua Wulf <jwulf>
Severity: medium Docs Contact:
Priority: low    
Version: 2.0CC: anross, jfearn, lcarlon, mdoyle, mmcallis, publican-list, r.landmann
Target Milestone: ---Keywords: Documentation
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-25 23:57:53 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Darrin Mison 2009-03-23 22:25:17 EDT
Description of problem:
if you have .xml files in a subdirectory of en-US and images in a subdirectory of en-US/images publican creates an incorrect path for the included image in the PDF.  It works fine with the html output

This is needed to try to maintain some source compatibility with some JBoss project docs

Version-Release number of selected component (if applicable):
0.44

How reproducible:
everytime

Steps to Reproduce:
1. Paths:
my_book/en-US/Chapter1/Section-A.xml
my_book/images/Chapter/figure.png

2. 
within my_book/en-US/Chapter1/Section-A.xml

<section>
    <title>A</title>
    
    <figure>
        <title>some figure</title>
        <mediaobject>
            <imageobject>
                <imagedata fileref="images/Chapter1/figure.png" />
            </imageobject>
        </mediaobject>
    </figure> 
</section>

3. make clean pdf-en-US

  
Actual results:
No image in PDF and this error message: 

Mar 24, 2009 12:07:35 PM org.apache.fop.fo.flow.ExternalGraphic bind
SEVERE: Image not found: Chapter-1/Chapter-1/images/Chapter-1/figure.png
Mar 24, 2009 12:07:35 PM org.apache.fop.render.pdf.PDFRenderer putImage
SEVERE: Image not found: Chapter-1/Chapter-1/images/Chapter-1/figure.png


Expected results:
Image in PDF

Additional info:
This can be worked around in the PDF by supplying the path as:  ../../images/Chapter1/figure.png , but this breaks the html
Comment 1 Jeff Fearn 2009-03-23 23:33:15 EDT
Could you test this for me on a some books?

test1: with flat xml and flat images

test2: with flat xml and nested images

test3: with nested xml and flat images

test4: with nested xml and nested images

proposed change:

edit: /usr/share/publican/pdf.xsl

on line 58 change: keep.relative.image.uris from select="0" to select="1"

FYI: Zero is the default in the DocBook xslt for FO output.
Comment 2 Darrin Mison 2009-04-08 02:04:45 EDT
keep.relative.image.uris  select="1" works

tested with pdf, html and html-single

only in English, don't know if there would be any translation issues
Comment 3 Andrew Ross 2009-04-09 17:28:12 EDT
YAY. That was driving me nuts!

Minor typo in the path

/usr/share/publican/xsl/pdf.xsl
Comment 4 Michael Hideo 2009-06-16 22:06:22 EDT
Hi Darrin, is this still a problem with the latest release?
Comment 5 Andrew Ross 2009-06-16 22:22:34 EDT
Still broken in publican-0.45-0.el5

eg. SEVERE: Image not found: PC_Setup/images/Vpn/WiFi-WEP.png
Comment 6 Darrin Mison 2009-06-29 01:53:29 EDT
ah, yeah still broken.  I'd modifed my pdf.xsl as per above & had to reinstall to check.
Comment 7 Jeff Fearn 2009-08-10 19:25:34 EDT
This should be fixed in the BETA.
Comment 8 Ruediger Landmann 2009-09-08 01:54:59 EDT
The version of pdf.xsl installed by the BETA still contains select="0" and therefore does not include images when both the XML and the images are in subdirectories, as originally reported.

Changing to select="1" allows the BETA find the images and include them correctly.
Comment 9 Jeff Fearn 2009-09-08 19:26:20 EDT
Check in this fix, so it will be in 1.0:

$ svn diff -r779:780 datadir/xsl/pdf.xsl 
Index: datadir/xsl/pdf.xsl
===================================================================
--- datadir/xsl/pdf.xsl (revision 779)
+++ datadir/xsl/pdf.xsl (revision 780)
@@ -58,7 +58,7 @@
 <xsl:param name="fop1.extensions" select="1"/>
 <xsl:param name="img.src.path"/>
 <xsl:param name="qandadiv.autolabel" select="1"/>
-<xsl:param name="keep.relative.image.uris" select="0"/>
+<xsl:param name="keep.relative.image.uris" select="1"/>
 <xsl:param name="email.delimiters.enabled">0</xsl:param>
 
 <xsl:param name="hyphenation-character">
Comment 10 Ruediger Landmann 2009-09-09 18:47:56 EDT
Fixed in 1.0

With that modification to pdf.xsl, Publican finds and uses the image correctly.
Comment 12 Fedora Update System 2009-11-17 21:19:18 EST
publican-1.2-0.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/publican-1.2-0.fc12
Comment 13 Fedora Update System 2009-11-20 00:18:26 EST
publican-1.2-0.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2009-11-25 09:53:33 EST
publican-1.2-0.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.