1 2 Previous Next 25 Replies Latest reply on Jul 31, 2008 8:30 AM by anne-mariebarthe Go to original post
      • 15. Re: Using jdocbook
        sebersole

         

        "nbhatia" wrote:

        1) I don't see images copied over from src\main\resources\shared\images to target

        Why would they be?

        "nbhatia" wrote:

        2) The URL should probably have file:/// prepended to it. Xalan seems to be forgiving about this but saxon is not.

        Nothing to do with SAXON or XALAN. Look at your stack trace. It is FOP. FOP is the one assuming that 'img.src.path' is supposed to be a URL reference instead of a File reference. Unfortunately the docbook folks are not forthcoming about exactly which form is expected...

        • 16. Re: Using jdocbook
          nbhatia

           


          "nbhatia" wrote:
          1) I don't see images copied over from src\main\resources\shared\images to target
          "steve.ebersole@jboss.com" wrote:
          Why would they be?


          Sorry for the confusion. This has nothing to do with PDF generation. I will need the images for the html generation and I don't see them anywhere in the target folder. They are available in the src folder mentioned above.

          2. Got the point about MalformedURLException coming from FOP. Thanks.



          • 17. Re: Using jdocbook
            sebersole

             

            "nbhatia" wrote:

            "nbhatia" wrote:
            1) I don't see images copied over from src\main\resources\shared\images to target
            "steve.ebersole@jboss.com" wrote:
            Why would they be?


            Sorry for the confusion. This has nothing to do with PDF generation. I will need the images for the html generation and I don't see them anywhere in the target folder. They are available in the src folder mentioned above.

            You need to tell the jdocbook plugin about the images:

            <configuration>
             <imageResource>
             <directory>${basedir}/src/main/resources</directory>
             <includes>
             <include>*</include>
             </includes>
             </imageResource>
             ...
            </configuration>
            


            • 18. Re: Using jdocbook
              sebersole

              As for the other, I need to find someone with FOP experience/knowledge. Know anyone?

              • 19. Re: Using jdocbook
                nbhatia

                Steve, I tried the imageResource configuration as suggested by you. I am running into couple of problems:

                1) It only copies the files from the specified directory, not the directory structure. My resource directory structure is shown below. Is there any way to copy the entire structure?

                src/main/resources/
                 shared/
                 css/
                 *.css
                 images/
                 magicdraw/
                 *.jpg
                 argouml/
                 *.jpg
                 misc
                


                Also is there a way to exclue the misc directory? (It contains source files for jpg images such as visio diagrams etc.)

                2) I would like my css and images to be shared between html and html_single output (just like hibernate docs). Currently the images are dropped inside the html folder. This is what I would like instead. Is that possible?

                target
                 docbook
                 html
                 html_single
                 shared
                 images
                


                I totally understand if the plugin was not designed for these usecases, just want to make sure I am not missing anything.

                • 20. Re: Using jdocbook
                  nbhatia

                  Steve,

                  Please ignore my previous post. I have resolved most of the issues by simplifying my directory structure.

                  1) I realized that the image directory structure can be copied using **/* syntax in imageResource tag. So this is not an issue any more.

                  2) Instead of sharing images and css between html and html_single, I am using the default layout of the plugin, i.e. images and css under html and html_single directories. Although this consumes more space, it does make the two output directories self contained.

                  3) Because of the above decision, image and css paths have now simplified from "../shared/images/xyz.jpg" to simply "xyz.jpg". As a result FOP is no longer giving a MalformedURLException. Yeah!

                  The only minor issue I have right now is with the html and html_single output. The images and css are currently output at the root level. I would like them to be pushed one level down - under images and css directories - just like they are in staging. Is it possible to do this? I tried to play with "imagesDirectory" and "cssDirectry" elements described under Usage (http://labs.jboss.com/maven-jdocbook-plugin/usage.html), but that didn't help. I think these elements apply only to the staging directory, but they don't seem to be doing anything to the staging directory either.

                  • 21. Re: Using jdocbook
                    nbhatia

                    One more thing. When processing the PDF, I am getting the following error:

                    [INFO] [jdocbook:generate]
                    [INFO] building formatting result [D:\ProjectsTest\DocBook\andromda-tutorial-java\target\docbook\pdf\andromda-tutorial-java.pdf]
                    Aug 18, 2007 2:07:07 PM org.apache.fop.fo.flow.ExternalGraphic bind
                    SEVERE: Image not available: url(1)
                    


                    I suspect this is because FO cannot find the title page image defined in fopdf.xsl (taken from hibernate):

                     <xsl:param name="custom.titlepage.img">1</xsl:param>
                     ...
                     <xsl:call-template name="fo-external-image">
                     <xsl:with-param name="filename" select="$custom.titlepage.img"/>
                     </xsl:call-template>
                    


                    1) How do I specify the title page image?
                    2) Is there any way to see the .fo file produced by Saxon?

                    • 22. Re: Using jdocbook
                      nbhatia

                      Answering question #1 myself :-). All I needed to do was to specify the image name in the fopdf.xsl (just replaced the "1" with the image name):

                       <xsl:param name="custom.titlepage.img">shared/TitlePageLogo.jpg</xsl:param>
                      


                      • 23. Re: Using jdocbook
                        nbhatia

                        Inspite of setting

                         <xsl:param name="custom.titlepage.img">shared/TitlePageLogo.jpg</xsl:param>
                        


                        I am getting the following error during pdf generation:

                        [INFO] [jdocbook:generate]
                        [DEBUG] Found docbook version : 1.72.0
                        [DEBUG] starting formatting [html_single]
                        [DEBUG] preparing target file [index.html]
                        [DEBUG] enforcing retention of relative image URIs
                        [DEBUG] starting formatting [html]
                        [DEBUG] preparing target file [index.html]
                        [DEBUG] enforcing retention of relative image URIs
                        [DEBUG] Chunking output.
                        [DEBUG] starting formatting [pdf]
                        [DEBUG] preparing target file [andromda-tutorial-java.pdf]
                        [DEBUG] setting 'img.src.path' [D:\ProjectsTest\DocBook\andromda-tutorial-java\target\staging/images/]
                        [DEBUG] enforcing retention of relative image URIs
                        [INFO] building formatting result [D:\ProjectsTest\DocBook\andromda-tutorial-java\target\docbook\pdf\andromda-tutorial-java.pdf]
                        Aug 19, 2007 11:55:35 AM org.apache.fop.fo.flow.ExternalGraphic bind
                        SEVERE: Image not available: url(shared/TitlePageLogo.jpg)
                        


                        'img.src.path' is correct, also url for the title page image is correct - still this error. It is interesting that an image included in on of my docbook chapters with similar path is picked up without any problems:

                         <imagedata fileref="shared/AndromdaArchJava.jpg" format="JPG" align="center"/>
                        


                        • 24. Re: Using jdocbook
                          anne-mariebarthe

                          Hello,

                          I am using jdocbook with a maven project.

                          My problem is the following : the tree structure of our projects is not compatible with the one used by default by the JDocbook plugin (like the path and name of the staging directory).
                          It is impossible to generate the documentations with pictures, using a CSS for the HTML generation, etc.

                          I tried a solution : I modified the sources of the JDocbook plugin. In the AbstractDocBookMojo class (package : org.jboss.maven.plugins.jdocbook), I removed the "@readonly" annotation.
                          So, I set my own name and path for this directory into the POM file (see configuration below). With this modification, the documentation is perfectly generated.

                           <configuration>
                           <imageResource>
                           <directory>${basedir}/src/doc/resources/images</directory>
                           </imageResource>
                           <cssResource>
                           <directory>${basedir}/src/doc/resources/css</directory>
                           </cssResource>
                          
                           <!-- I have added this parameter to configure the path of stagingDirectory (which is no more "read only")-->
                           <stagingDirectory>${basedir}/target/docbook/publish/resources</stagingDirectory>
                          
                           <sourceDirectory>${basedir}/src/doc/docbook/doc-en</sourceDirectory>
                           <sourceDocumentName>dragon-doc.xml</sourceDocumentName>
                           <publishDirectory>${basedir}/target/docbook/publish</publishDirectory>
                          
                           <formats>
                           <format>
                           <formatName>pdf</formatName>
                           <stylesheetResource>file:${basedir}/tools/stylesheets/fo.xsl</stylesheetResource>
                           <finalName>dragon-docbook-${version}.pdf</finalName>
                           </format>
                           <format>
                           <formatName>html</formatName>
                           <stylesheetResource>file:${basedir}/tools/stylesheets/html.xsl</stylesheetResource>
                           <finalName>dragon-docbook-${version}.html</finalName>
                           </format>
                           </formats>
                          
                           <options>
                           <xincludeSupported>true</xincludeSupported>
                           <xmlTransformerType>saxon</xmlTransformerType>
                           </options>
                           </configuration>
                          




                          I would know if the deleting of the "@readonly" has consequences on other classes, methods, etc. ?
                          In the future, the attribute stagingDirectory will be editable by the user ? Or will it remain with the "read only status" (if stagingDirectory will remain "read only", I will create a patch to be able to use it in our projects).

                          Thank you for your help !


                          • 25. Re: Using jdocbook
                            anne-mariebarthe

                            Sorry, I forgot two quite important things in my previous post :
                            - I work with the version 2.1.3-SNAPSHOT of the plugin
                            - I talk about the "@readonly" annotation of the stagingDirectory attribute...

                            1 2 Previous Next