Lab 14 - Specialize the DITA OT PDF output using a plugin

During the lab, you will specialize the default DITA Open Toolkit PDF output to customize the titles and headers and footers of each page.

You can specialize the XSLT stylesheets used by the default DITA Open Toolkit PDF output by providing a plugin which contains your customization. Using Componize pipelines you can run this output processing.
  1. Copy the com.componize.custom-pdf plugin from the Eclipse resources into the plugins folder located in your DITA Open Toolkit installation.
  2. In the cfg/common/vars folder, open the en.xml file in your favorite editor.
  3. Change the value of the variable element with id Product Name.
    <variable id="Product Name">Componize</variable>
  4. Inside the variable element with id Body odd footer, add the following:
    Copyright &#169; 2018 Componize Software&#xA0;&#xA0;&#xA0;<param ref-name="pagenum" />
    <variable id="Body odd footer">
      Copyright &#169; 2018 Componize Software&#xA0;&#xA0;&#xA0;<param ref-name="pagenum" />
    </variable>
  5. Inside the variable element with id Body even footer, add the following:
    <param ref-name="pagenum" />&#xA0;&#xA0;&#xA0;Copyright &#169; 2018 Componize Software
    <variable id="Body even footer">
      <param ref-name="pagenum" />&#xA0;&#xA0;&#xA0;Copyright &#169; 2018 Componize Software
    </variable>
  6. Save your changes.
  7. In the cfg/fo/attrs folder, remove the .orig extension from the custom.xsl.orig file.
  8. Open the custom.xsl file in your favorite editor.
  9. Add the following xsl:attribute-set named topic.title:
    <xsl:attribute-set name="topic.title">
      <xsl:attribute name="break-before">page</xsl:attribute>
      <xsl:attribute name="font-size">18pt</xsl:attribute>
      <xsl:attribute name="font-weight">normal</xsl:attribute>
      <xsl:attribute name="color">#132E5E</xsl:attribute>
      <xsl:attribute name="space-after.minimum">0.6em</xsl:attribute>
      <xsl:attribute name="space-after.optimum">0.8em</xsl:attribute>
      <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
      <xsl:attribute name="space-after.precedence">1</xsl:attribute>
      <xsl:attribute name="start-indent">0pt</xsl:attribute>
      <xsl:attribute name="border-after-style">solid</xsl:attribute>
      <xsl:attribute name="border-after-width">1pt</xsl:attribute>
      <xsl:attribute name="border-color">#cccccc</xsl:attribute>
    </xsl:attribute-set>
  10. Save your changes.
  11. In the cfg/ folder, remove the .orig extension from the catalog.xml.orig file.
  12. Open the catalog.xml file in your favorite editor.
  13. Uncomment or add entries corresponding to the files you have customized.
    <uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>
    
    <uri name="cfg:/common/vars/en_US.xml" uri="common/vars/en.xml" />
    <uri name="cfg:/common/vars/en.xml" uri="common/vars/en.xml" />
  14. Save your changes.
  15. At the root of bin folder located in your DITA Open Toolkit installation, run the following command: dita --install
  16. Connect to the Alfresco Share interface.
  17. At the root of your Document Library, update the DITA Open Toolkit pipeline configuration file named ditaot-pdf.xml. Add a new transtype option which points to custom-pdf.
    <?xml version="1.0" encoding="UTF-8"?>
    <pipelineConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="cpnz:pipeline:xsd:pipeline-configuration.xsd">
        <pipeline>ditaot-pdf</pipeline>
        <options>
          <option>
            <name>transtype</name>
            <value>custom-pdf</value>
          </option>
    …
  18. Test your pipeline configuration on a sample ditamap file.

The PDF output should have customized level one titles and headers and footers on each page.