Edit online

Embedding a Company Logo

The following procedure explains how to embed a company logo image in the front matter of the book for the DITA Map PDF - based on XSL-FO transformation scenario.
  1. Create a customization directory (if you have not already done so).
  2. Create a cfg\common\artwork directory structure in your customization directory and copy your logo to that directory (for example, [C:\Customization\common\artwork\logo.png).
    Important: Make sure that your logo image is named: logo.png.
  3. Rename Customization\catalog.xml.orig to: Customization\catalog.xml.
  4. Open the catalog.xml in Oxygen XML Developer and uncomment this line:
      <!--uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/-->   
    It now looks like this:
    <uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
  5. Rename the file Customization\fo\xsl\custom.xsl.orig to: C:\Customization\fo\xsl\custom.xsl
  6. Open the custom.xsl file in Oxygen XML Developer and create the template called createFrontCoverContents for DITA-OT 4.1.2.
    Tip: You can copy the same template from DITA-OT-DIR\plugins\org.dita.pdf2\xsl\fo\front-matter.xsl and modify it in whatever way necessary to achieve your specific goal. This new template in the custom.xsl file will override the same template from DITA-OT-DIR\plugins\org.dita.pdf2\xsl\fo\front-matter.xsl.

    Example:

    For example, the custom.xsl could look like this:
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        version="2.0">
      
    <xsl:template name="createFrontCoverContents">
     <!-- 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>
      
     <!-- Load the image logo -->
      <fo:block text-align="center" width="100%">
       <fo:external-graphic
          src="url({concat($artworkPrefix, 
                              'Customization/OpenTopic/common/artwork/logo.png')})"
        />
      </fo:block>
     </xsl:template>
    
    </xsl:stylesheet>
  7. Edit the DITA Map PDF - based on XSL-FO transformation scenario, go to the Parameters tab, and set the customization.dir parameter to point to the location of your customization directory.
Tip: For other specific examples, see DITA-OT Documentation - Customizing PDF Output.