Book Covers
Prev | Chapter 3. Using dblatex | Next

## Book Covers

Since version 0.3.10 dblatex provides a basic support for page-size covers, when covers are defined as images to insert at the beginning of the document (front cover), or at the very end of the document (back cover).

To specify a cover, set in the book information element, `info` or `bookinfo`, the images to use in some `cover` elements (DocBook 5) or in `mediaobject` with role set to `cover` (DocBook 4).

If two covers are specified, it is assumed that the first one is for the front cover, and the second one for the back cover. You can play with standard `imagedata` width or depth attributes to ensure that the image is sized to fit the page covers.

Here are two examples:

Example 3.2. DocBook 5 Front and Back Covers

    <book>
     <info>
       ...
       <cover>
         <mediaobject>
           <imageobject>
             <imagedata fileref="cover-front-72dpi.png"
                        format="PNG" depth="100%" width="100%" align="left"/>
           </imageobject>
         </mediaobject>
       </cover>
       <cover>
         <mediaobject>
           <imageobject>
             <imagedata fileref="cover-back-72dpi.png"
                        format="PNG" depth="100%" width="100%" />
           </imageobject>
         </mediaobject>
       </cover>
     </info>
     ...
    </book>

Example 3.3. DocBook 4 Front Cover

    <book>
     <bookinfo>
       ...
       <mediaobject role="cover">
         <imageobject role="front-large">
           <imagedata fileref="cover-front-72dpi.png" format="PNG" width="100%" />
         </imageobject>
         <imageobject role="front">
           <imagedata fileref="cover-front-10dpi.png" format="PNG" width="444" />
         </imageobject>
         <imageobject role="front-small">
           <imagedata fileref="cover-front-10dpi.png" format="PNG" width="444" />
         </imageobject>
         <imageobject role="thumbnail">
           <imagedata fileref="cover-front-10dpi.png" format="PNG" width="444" />
         </imageobject>
       </mediaobject>
       ...
     </bookinfo>
     ...
    </book>

Note that in DocBook 4, dblatex filters on the same roles for `mediaobject` (`cover`) or for `imageobject` (`front-large`) than the DocBook Project does when it implement covers in epub format.

dblatex defines default templates `front.cover` and `back.cover` to implement covers through images, but you can overwrite them to create your own method to build covers.

Prev | Up | Next
Global Page Setup | Home | Chapter and Section numbering