maven-doxia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Jerman <stjer...@cisco.com>
Subject Using Relative URLs for images.
Date Thu, 17 Dec 2009 18:38:06 GMT
Hi folks,

At present Doxia (specifically the PDF plugin) only supports images with
URLs taken from the classpath or as absolute URLs. This doesn¹t affect
normal site generation since that just passes through the URL without
resolution and so everything works OK.

However, the PDF plugin tries to resolve the path names to images and with a
normal maven site/resources/images layout that that won¹t work. The reason
is that the Œbase¹ for resolving relative  file paths URLs is wrong by
default.

If I use the following pom config:

            <plugin>
                <groupId>org.apache.maven.doxia</groupId>
                <artifactId>doxia-maven-plugin</artifactId>
                <version>1.1.3-SNAPSHOT</version>
                <executions>
                    <execution>
                        <phase>site</phase>
                        <goals>
                            <goal>render-books</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                   
<generatedDocs>${project.build.directory}/site</generatedDocs>
                    <books>
                        <book>
                            <directory>src/site/apt</directory>
                            <descriptor>src/site/dev-guide.xml</descriptor>
                            <formats>
                                <format>
                                    <id>pdf</id>
                                </format>
                            </formats>
                        </book>
                    </books>
                </configuration>
            </plugin>

And change the location that Œitext.basedir¹ is set to (in 3-4 places...).

org.apache.maven.doxia.book.services.renderer.AbstractITextBookRenderer
org.apache.maven.doxia.docrenderer.itext.AbstractITextRender
org.apache.maven.doxia.docrenderer.pdf.itext.ITextPdfRenderer
org.apache.maven.doxia.module.itext.ITextSink

To..
        System.setProperty( "itext.basedir",
bookFile.getParentFile().getParentFile().getAbsolutePath() );

So that it looks two levels up rather than one level up... Everything seems
to work OK.

What the changes do are:

Generate the PDF to the site directory rather than it¹s own directory.
Create the site before generating PDFs .. note this puts the images in a
Œknown place¹ relative to the PDF output.
Set up the base for resolution to be consistent for both html and pdf
generation.

So... having said that, I¹m wondering what do to do next..

This change isn¹t entirely backwards compatible (but maybe someone can
figure out a way to make it so). I will create a patch for the change but am
not sure if it is worth doing if it isn¹t backwards compatible.. The
alternative is to keep a private version...

I know that a colleague of mine raised a Jira (
http://jira.codehaus.org/browse/DOXIA-356) on this subject.

Any thoughts? 

Steve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message