1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE html
|
---|
3 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
4 | <html xml:lang="en" lang="en">
|
---|
5 | <head>
|
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
---|
7 | <meta name="copyright" content="(C) Copyright 2005"/>
|
---|
8 | <meta name="DC.rights.owner" content="(C) Copyright 2005"/>
|
---|
9 | <meta name="DC.Type" content="task"/>
|
---|
10 | <meta name="DC.Title" content="Customizing PDF output"/>
|
---|
11 | <meta name="abstract" content="Example of PDF output customization with a custom transformation type."/>
|
---|
12 | <meta name="description" content="Example of PDF output customization with a custom transformation type."/>
|
---|
13 | <meta name="DC.Relation" scheme="URI" content="../dev_ref/developer-reference.html"/>
|
---|
14 | <meta name="DC.Format" content="XHTML"/>
|
---|
15 | <meta name="DC.Identifier" content="dita2pdf-customization"/>
|
---|
16 | <meta name="DC.Language" content="en"/>
|
---|
17 | <link rel="stylesheet" type="text/css" href="../commonltr.css"/>
|
---|
18 | <link rel="stylesheet" type="text/css" href="../dita-ot-doc.css"/>
|
---|
19 | <title>Customizing PDF output</title>
|
---|
20 | </head>
|
---|
21 | <body id="dita2pdf-customization">
|
---|
22 |
|
---|
23 |
|
---|
24 | <h1 class="title topictitle1">Customizing PDF output</h1>
|
---|
25 |
|
---|
26 |
|
---|
27 | <div class="body taskbody"><p class="shortdesc">Example of PDF output customization with a custom transformation type.</p>
|
---|
28 |
|
---|
29 | <div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
|
---|
30 | <span class="ph cmd">Create a new plug-in directory <span class="ph filepath">com.example.print-pdf</span> into DITA-OT
|
---|
31 | <span class="ph filepath">plugins</span> directory.</span>
|
---|
32 | </li>
|
---|
33 | <li class="li step stepexpand">
|
---|
34 | <span class="ph cmd">Create a plug-in configuration file <span class="ph filepath">plugin.xml</span>, declare the new
|
---|
35 | transformation type <span class="keyword">print-pdf</span> and dependencies.</span>
|
---|
36 | <div class="itemgroup info"><div class="fig fignone"><pre class="pre codeblock"><?xml version='1.0' encoding='UTF-8'?>
|
---|
37 | <plugin id="com.example.print-pdf">
|
---|
38 | <require plugin="org.dita.pdf2"/>
|
---|
39 | <feature extension="dita.conductor.transtype.check" value="print-pdf"/>
|
---|
40 | <feature extension="dita.transtype.print" value="print-pdf"/>
|
---|
41 | <feature extension="dita.conductor.target.relative" file="integrator.xml"/>
|
---|
42 | </plugin></pre>
|
---|
43 | </div>
|
---|
44 | </div>
|
---|
45 | </li>
|
---|
46 | <li class="li step stepexpand">
|
---|
47 | <span class="ph cmd">Add an Ant script <span class="ph filepath">integrator.xml</span> to define the transformation
|
---|
48 | type.</span>
|
---|
49 | <div class="itemgroup info"><pre class="pre codeblock"><?xml version='1.0' encoding='UTF-8'?>
|
---|
50 | <project name="com.example.print-pdf">
|
---|
51 | <target name="dita2print-pdf.init">
|
---|
52 | <property name="customization.dir" location="${dita.plugin.com.example.print-pdf.dir}/cfg"/>
|
---|
53 | </target>
|
---|
54 | <target name="dita2print-pdf" depends="dita2print-pdf.init, dita2pdf2"/>
|
---|
55 | </project></pre>
|
---|
56 | </div>
|
---|
57 | </li>
|
---|
58 | <li class="li step stepexpand">
|
---|
59 | <span class="ph cmd">Add a <span class="ph filepath">cfg/catalog.xml</span> file to take custom XSLT stylesheets into
|
---|
60 | use.</span>
|
---|
61 | <div class="itemgroup info"><pre class="pre codeblock"><?xml version="1.0" encoding="UTF-8"?>
|
---|
62 | <catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
---|
63 | <uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>
|
---|
64 | <uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
|
---|
65 | </catalog></pre>
|
---|
66 | </div>
|
---|
67 | </li>
|
---|
68 | <li class="li step stepexpand">
|
---|
69 | <span class="ph cmd">Add attribute and variable overrides to
|
---|
70 | <span class="ph filepath">cfg/fo/attrs/custom.xsl</span></span>
|
---|
71 | <div class="itemgroup info"> <pre class="pre codeblock"><?xml version="1.0" encoding="UTF-8"?>
|
---|
72 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
73 | version="2.0">
|
---|
74 | <!-- Change page size to A4 -->
|
---|
75 | <xsl:variable name="page-width">210mm</xsl:variable>
|
---|
76 | <xsl:variable name="page-height">297mm</xsl:variable>
|
---|
77 | </xsl:stylesheet></pre>
|
---|
78 | </div>
|
---|
79 | </li>
|
---|
80 | <li class="li step stepexpand">
|
---|
81 | <span class="ph cmd">Add XSLT overrides to <span class="ph filepath">cfg/fo/xsl/custom.xsl</span></span>
|
---|
82 | <div class="itemgroup info">
|
---|
83 | <pre class="pre codeblock"><?xml version="1.0" encoding="UTF-8"?>
|
---|
84 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
85 | xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
---|
86 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
87 | version="2.0">
|
---|
88 | <!-- Move figure title to top and description to bottom -->
|
---|
89 | <xsl:template match="*[contains(@class,' topic/fig ')]">
|
---|
90 | <fo:block xsl:use-attribute-sets="fig">
|
---|
91 | <xsl:call-template name="commonattributes"/>
|
---|
92 | <xsl:if test="not(@id)">
|
---|
93 | <xsl:attribute name="id">
|
---|
94 | <xsl:call-template name="get-id"/>
|
---|
95 | </xsl:attribute>
|
---|
96 | </xsl:if>
|
---|
97 | <xsl:apply-templates select="*[contains(@class,' topic/title ')]"/>
|
---|
98 | <xsl:apply-templates select="*[not(contains(@class,' topic/title ') or contains(@class,' topic/desc '))]"/>
|
---|
99 | <xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/>
|
---|
100 | </fo:block>
|
---|
101 | </xsl:template>
|
---|
102 | </xsl:stylesheet></pre>
|
---|
103 |
|
---|
104 | </div>
|
---|
105 | </li>
|
---|
106 | <li class="li step stepexpand">
|
---|
107 | <span class="ph cmd">Add variable definition file <span class="ph filepath">cfg/common/vars/en.xml</span> for English to
|
---|
108 | override generated text.</span>
|
---|
109 | <div class="itemgroup info">
|
---|
110 | <pre class="pre codeblock"><?xml version="1.0" encoding="UTF-8"?>
|
---|
111 | <vars xmlns="http://www.idiominc.com/opentopic/vars">
|
---|
112 | <!-- Remove dot from list number -->
|
---|
113 | <variable id="Ordered List Number"><param ref-name="number"/></variable>
|
---|
114 | <!-- Change unordered list bullet to an em dash -->
|
---|
115 | <variable id="Unordered List bullet">&#x2014;</variable>
|
---|
116 | </vars></pre>
|
---|
117 |
|
---|
118 | </div>
|
---|
119 | </li>
|
---|
120 | </ol>
|
---|
121 |
|
---|
122 | <div class="section result" id="dita2pdf-customization__result_23y_yv3_tf"><div class="tasklabel"><h2 class="sectiontitle tasklabel">Results</h2></div>
|
---|
123 | <p class="p">The plug-in directory should have the layout and files:</p>
|
---|
124 |
|
---|
125 | <pre class="pre codeblock">com.example.print-pdf/
|
---|
126 | cfg/
|
---|
127 | common/
|
---|
128 | vars/
|
---|
129 | en.xml
|
---|
130 | fo/
|
---|
131 | attrs/
|
---|
132 | custom.xsl
|
---|
133 | xsl/
|
---|
134 | custom.xsl
|
---|
135 | catalog.xml
|
---|
136 | integrator.xml
|
---|
137 | plugin.xml</pre>
|
---|
138 |
|
---|
139 | </div>
|
---|
140 |
|
---|
141 | <div class="section postreq" id="dita2pdf-customization__postreq_mqj_zz3_tf"><div class="tasklabel"><h2 class="sectiontitle tasklabel">What to do next</h2></div>
|
---|
142 | <p class="p">Run integration process to install the plug-in and take the <span class="keyword">print-pdf</span>
|
---|
143 | transformation type into use.</p>
|
---|
144 |
|
---|
145 | </div>
|
---|
146 |
|
---|
147 | </div>
|
---|
148 |
|
---|
149 | <div class="related-links">
|
---|
150 | <div class="familylinks">
|
---|
151 | <div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../dev_ref/developer-reference.html" title="The DITA Open Toolkit Developer Reference is designed to provide more advanced information about the DITA OT. It is geared to an audience that needs information about the DITA-OT architecture, configuring and extending the DITA-OT, and creating DITA-OT plug-ins.">DITA Open Toolkit Developer Reference</a></div>
|
---|
152 | </div>
|
---|
153 | </div>
|
---|
154 |
|
---|
155 | </body>
|
---|
156 | </html>
|
---|