Table of Contents
More Resources
Adding Images to the Cover Page
Cover Page
Customize your PDF by adding an image to your cover page.
Editing the Cover Page Template
Edit the custom-xsl.xsl to add an image to the cover page.
Adding Cover Page Attributes
Define attribute sets so that your cover page appears as expected.
Cover Page

Customize your PDF by adding an image to your cover page.
section
You can customize your PDF output to add your company logo to the cover page. Adding an image to your cover page requires:
Editing the Cover Page Template

Edit the custom-xsl.xsl to add an image to the cover page.
context

You want to add a header template to the custom-xsl.xsl file (located in cfg/fo/xsl/).

  1. To change the appearance of the cover page, you need to modify the createFrontMatter_1.0 template:

    Step Information
    < xsl:template name="createFrontMatter_1.0"> 
      < fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count"> 
        < xsl:call-template name="insertFrontMatterStaticContents"/> 
        < fo:flow flow-name="xsl-region-body"> 
          < fo:block xsl:use-attribute-sets="__frontmatter"> 
            < !-- set the title --> 
            < fo:block xsl:use-attribute-sets="__frontmatter__title"> 
              < xsl:choose> 
                < xsl:when test="$map/*[contains(@class,' topic/title ')][1]"> 
                  < xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"> 
                  < xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="//*[contains(@class, ' map/map ')]/@title"> 
                  < xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/> 
                < /xsl:when> 
                < xsl:otherwise> 
                  < xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/> 
                < /xsl:otherwise> 
              < /xsl:choose> 
            < /fo:block> 
    
            < !-- set the subtitle --> 
            < xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/> 
    
            < fo:block xsl:use-attribute-sets="__frontmatter__owner"> 
              < xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/> 
            < /fo:block> 
          < /fo:block> 		
        < /fo:flow> 
      < /fo:page-sequence> 
      < xsl:if test="not($retain-bookmap-order)"> 
        < xsl:call-template name="createNotices"/> 
      < /xsl:if> 
    < /xsl:template> 

  2. Build the fo:block-container that contains the image that you want:

    Step Information
    < fo:block-container xsl:use-attribute-sets="__coverImage"> 
      < fo:block> 
        < fo:external-graphic src="url(Customization/OpenTopic/common/artwork/[image.name])"/> 
      < /fo:block> 
    < /fo:block-container> 
    Note:This code assume that your image file (named [image.name]) is located in the cfg/common/artwork folder.

  3. Add the fo:block-container above the title:

    Expected Result
    < xsl:template name="createFrontMatter_1.0"> 
      < fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count"> 
        < xsl:call-template name="insertFrontMatterStaticContents"/> 
        < fo:flow flow-name="xsl-region-body"> 
          < fo:block xsl:use-attribute-sets="__frontmatter"> 
    
            < !-- cover image --> 
            < fo:block-container xsl:use-attribute-sets="__coverImage"> 
              < fo:block> 
               < fo:external-graphic src="url(Customization/OpenTopic/common/artwork/[image.name])"/> 
              < /fo:block> 
            < /fo:block-container> 
    
            < !-- set the title --> 
            < fo:block xsl:use-attribute-sets="__frontmatter__title"> 
              < xsl:choose> 
                < xsl:when test="$map/*[contains(@class,' topic/title ')][1]"> 
                  < xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"> 
                  < xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="//*[contains(@class, ' map/map ')]/@title"> 
                  < xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/> 
                < /xsl:when> 
                < xsl:otherwise> 
                  < xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/> 
                < /xsl:otherwise> 
              < /xsl:choose> 
            < /fo:block> 
    
            < !-- set the subtitle --> 
            < xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/> 
    
            < fo:block xsl:use-attribute-sets="__frontmatter__owner"> 
              < xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/> 
            < /fo:block> 
          < /fo:block> 		
        < /fo:flow> 
      < /fo:page-sequence> 
      < xsl:if test="not($retain-bookmap-order)"> 
        < xsl:call-template name="createNotices"/> 
      < /xsl:if> 
    < /xsl:template> 

result

You edited the cover page template in the custom-xsl.xsl file located in cfg/fo/xsl/.

postreq
Your cover page template contains a new attribute-set, which you need to define using the procedure in Adding Cover Page Attributes.
Adding Cover Page Attributes

Define attribute sets so that your cover page appears as expected.
prereq
Before you can add new attribute-sets, you must modified the cover page template using the procedure in Editing the Cover Page Template.

context

While Editing the Cover Page Template, you added a new attribute-set. You need to define this attribute in the custom-attrs.xsl file (located in cfg/fo/attrs/) for your cover page to display correctly.

  1. Insert the following code:

    Step Information
    You can add whatever other styling attributes you want here, but the following code will center the image horizontally and give it a little space from the top of the page.
    < xsl:attribute-set name="__coverImage"> 
      < xsl:attribute name="text-align"> center< /xsl:attribute> 
      < xsl:attribute name="position"> absolute< /xsl:attribute> 
      < xsl:attribute name="top"> 80px< /xsl:attribute> 
    < /xsl:attribute-set> 

result
You’re ready to publish with your new cover page. Here’s an example of the output: