pdf-plugin-structure.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2016"><meta name="DC.rights.owner" content="(C) Copyright 2016"><meta name="DC.Type" content="concept"><meta name="description" content="In cases that require substantial customizations, it is often useful to organize the files in a folder structure that mimics the hierarchy of the default PDF plug-in. This method facilitates comparisons with the default settings in the base PDF plug-in and makes it easier to migrate customizations to new toolkit versions."><meta name="DC.Relation" scheme="URI" content="../dev_ref/pdf-customization.html"><meta name="DC.Format" content="XHTML"><meta name="DC.Identifier" content="pdf-plugin-structure"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>PDF plug-in structure</title></head><body id="pdf-plugin-structure"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 2.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../getting-started/index.html">Getting Started</a></li><li><a href="../user-guide/index.html">User Guide</a></li><li><a href="../parameters/index.html">Parameter Reference</a></li><li><a href="../dev_ref/index.html">Developer Reference</a><ul><li><a href="../dev_ref/DITA-OTArchitecture.html">DITA-OT Architecture</a></li><li><a href="../dev_ref/extending-the-ot.html">Extending the DITA-OT</a></li><li><a href="../dev_ref/plugin-creating.html">Creating plug-ins</a></li><li><a href="../dev_ref/plugin-extension-points.html">Extension points</a></li><li><a href="../dev_ref/pdf-customization.html">Customizing PDF output</a><ul><li><a href="../dev_ref/pdf-transformation-history.html">History of the PDF transformation</a></li><li><a href="../dev_ref/pdf-customization-approaches.html">PDF customization approaches</a></li><li><a href="../dev_ref/pdf-customization-plugin-types.html">Types of custom PDF plug-ins</a></li><li class="active"><a href="../dev_ref/pdf-plugin-structure.html">PDF plug-in structure</a></li><li><a href="../dev_ref/pdf-customization-example.html">Simple PDF plug-in example</a></li><li><a href="../dev_ref/pdf-customization-best-practices.html">Customization best practices</a></li><li><a href="../dev_ref/pdf-customization-resources.html">Custom PDF plug-in resources</a></li></ul></li><li><a href="../dev_ref/migration.html">Migrating customizations</a></li></ul></li><li><a href="../user-guide/dita-and-dita-ot-resources.html">DITA Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">PDF plug-in structure</h1>
  8. <div class="body conbody"><p class="shortdesc">In cases that require substantial customizations, it is often useful to organize the files in a folder
  9. structure that mimics the hierarchy of the default PDF plug-in. This method facilitates comparisons with the default
  10. settings in the base PDF plug-in and makes it easier to migrate customizations to new toolkit versions.</p>
  11. <div class="note note note_note"><span class="note__title notetitle">Note:</span> For simpler customizations, you may want to structure your plug-in differently, but the information in this
  12. topic may help you to locate the files you need to customize.</div>
  13. <p class="p">The original Idiom plug-in used its own extension mechanism to provide overrides to the PDF transformation. With
  14. this approach, a dedicated folder within the plug-in was used to store customized files. While this method is no
  15. longer recommended, the same organization principles can be used in custom PDF plug-ins.</p>
  16. <p class="p">To begin creating a new custom plug-in, you can copy the <span class="ph filepath">plugins/org.dita.pdf2/Customization</span>
  17. folder to a new folder, such as <span class="ph filepath">plugins/com.company.pdf</span>.</p>
  18. <p class="p">DITA-OT provides template files that you can start with throughout the <span class="ph filepath">Customization</span>
  19. directory structure. These files end in the suffix <code class="ph codeph">.orig</code> (for example,
  20. <span class="ph filepath">catalog.xml.orig</span>). To enable these files, copy them to your custom plug-in and remove the
  21. <code class="ph codeph">.orig</code> suffix. For example, copy <span class="ph filepath">catalog.xml.orig</span> to
  22. <span class="ph filepath">catalog.xml</span>. You can then make modifications to the copy in your custom plug-in folder.</p>
  23. <p class="p">Things you can currently override include:</p>
  24. <ul class="ul">
  25. <li class="li">Custom XSL via <span class="ph filepath">xsl/custom.xsl</span> and <span class="ph filepath">attrs/custom.xsl</span></li>
  26. <li class="li">Layout overrides via <span class="ph filepath">layout-masters.xsl</span></li>
  27. <li class="li">Font overrides via <span class="ph filepath">font-mappings.xml</span></li>
  28. <li class="li">Per-locale variable overrides via <span class="ph filepath">common/vars/[language].xml</span></li>
  29. <li class="li">I18N configuration via <span class="ph filepath">i18n/[language].xml</span></li>
  30. <li class="li">Index configuration via <span class="ph filepath">index/[language].xml</span></li>
  31. </ul>
  32. <p class="p">When customizing any of these areas, modify the relevant file(s) in your custom plug-in folder. Then, to enable
  33. the changes in the publishing process, you find the corresponding entry for each file you modified in the
  34. <span class="ph filepath">catalog.xml</span> file.</p>
  35. <p class="p">It should look like this:</p>
  36. <pre class="pre codeblock"><code>&lt;!--uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/--&gt;</code></pre>
  37. <p class="p">Remove the comment markers <code class="ph codeph">!--</code> and <code class="ph codeph">--</code> to enable the change:</p>
  38. <pre class="pre codeblock"><code>&lt;uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/&gt;</code></pre>
  39. <p class="p">Your customization should now be enabled as part of the publishing process.</p>
  40. <p class="p">When your custom plug-in is installed, the files in its subfolders will override the out-of-the-box settings from
  41. their counterparts in <span class="ph filepath">org.dita.pdf2/cfg/fo/attrs</span> and
  42. <span class="ph filepath">org.dita.pdf2/xsl/fo</span>.</p>
  43. <section class="section" id="pdf-plugin-structure__custom_artwork_the_common_artwork_folder"><h2 class="title sectiontitle">Custom artwork: the <span class="ph filepath">common/artwork</span> folder</h2>
  44. <p class="p">This folder houses custom artwork files that override the standard ones in
  45. <span class="ph filepath">org.dita.pdf2/cfg/common/artwork</span>. These files are used to graphically identify different
  46. types of DITA <code class="keyword markupname xmlelement">&lt;note&gt;</code> element.</p>
  47. <p class="p">The mapping between <code class="keyword markupname xmlelement">&lt;note&gt;</code> type and graphic is contained in a subset of the
  48. locale-dependent variable files, such as</p>
  49. <pre class="pre codeblock"><code>cfg/common/vars</code></pre>
  50. <p class="p">The variables that control <code class="keyword markupname xmlelement">&lt;note&gt;</code> graphics all follow the form</p>
  51. <pre class="pre codeblock"><code> &lt;variable id="{type} Note Image Path"&gt; {Path to image file} &lt;/variable&gt;</code></pre>
  52. <p class="p">where {type} contains a possible value for the <code class="keyword markupname xmlelement">&lt;note&gt;</code>
  53. <code class="keyword markupname xmlatt">@type</code> attribute.</p>
  54. </section>
  55. <section class="section" id="pdf-plugin-structure__index_configuration_the_common_index_folder"><h2 class="title sectiontitle">Index configuration: the <span class="ph filepath">common/index</span> folder</h2>
  56. <p class="p">This folder houses custom index definition files that override the standard ones in
  57. <span class="ph filepath">org.dita.pdf2/cfg/common/index</span>. Each file contains data for a single language, and should
  58. take that language’s ISO 639-1 language designator as its name (for example, <span class="ph filepath">pt.xml</span> for
  59. Portuguese). If necessary, locale-specific customizations can be provided by adding a region designator to the
  60. file name (for example, <span class="ph filepath">pt_BR.xml</span> for Brazilian Portuguese).</p>
  61. <p class="p">The index files consist of <code class="keyword markupname xmlelement">&lt;index.group&gt;</code> elements which contain sorting information on
  62. one or more characters. Index groups are listed in sort order (“specials” before numbers, numbers before the
  63. letter ‘A‘, etc), and the <code class="keyword markupname xmlelement">&lt;char.set&gt;</code> entries they contain are also listed in sort order
  64. (uppercase before lowercase).</p>
  65. <p class="p">The best way to start editing a custom index file is by making a copy of the original from
  66. <span class="ph filepath">org.dita.pdf2/cfg/common/index</span> and making changes as desired.</p>
  67. <p class="p">In order to apply a custom index definition to your publishing outputs, edit <span class="ph filepath">catalog.xml</span>
  68. and uncomment the appropriate entry in the “Index configuration override entries” section.</p>
  69. </section>
  70. <section class="section" id="pdf-plugin-structure__variable_overrides_the_common_vars_folder"><h2 class="title sectiontitle">Variable overrides: the <span class="ph filepath">common/vars</span> folder</h2>
  71. <p class="p">This folder houses custom variable definitions that override the standard ones in
  72. <span class="ph filepath">org.dita.pdf2/cfg/common/vars</span>. As with index configuration, Each file contains data for a
  73. single language, and should take that language’s ISO 639-1 language designator as its name.</p>
  74. <p class="p">Variable files contain a set of <code class="keyword markupname xmlelement">&lt;variable&gt;</code> elements, identified by their
  75. <code class="keyword markupname xmlatt">@id</code> attribute. The variable definitions are used to store static text that is used as part of
  76. the published outputs. For example, page headers, hyperlinks, etc. The id attribute for each variable should
  77. make it clear how the variable text is being used.</p>
  78. <p class="p">Some variables contain <code class="keyword markupname xmlelement">&lt;param&gt;</code> elements which indicate parameter values that are
  79. substituted at publish time by the XSL. For example, a page number that is being generated as part of the
  80. publishing process might be identified by &lt;param ref-name="number"/&gt; When editing or translating a
  81. variable file, these should be included in the translation, though they can be moved and rearranged within the
  82. <code class="keyword markupname xmlelement">&lt;variable&gt;</code> content as needed.</p>
  83. <p class="p">The best way to start editing a custom variables file is by making a copy of the original from
  84. <span class="ph filepath">org.dita.pdf2/cfg/common/vars</span> and making changes as desired. When adding a new language,
  85. start from an existing language’s list of variables and translate each entry as needed.</p>
  86. <p class="p">Note that unchanged <code class="keyword markupname xmlelement">&lt;variable&gt;</code> elements can be omitted: the custom variables file need
  87. only include those <code class="keyword markupname xmlelement">&lt;variable&gt;</code> elements which you have modified. Variables not found in
  88. the custom file will are taken from the standard variable files.</p>
  89. <p class="p">Applying a custom variable does not require modifying the <span class="ph filepath">catalog.xml</span> file. The publishing
  90. process will automatically use any custom variables definitions in place of the original ones.</p>
  91. </section>
  92. <section class="section" id="pdf-plugin-structure__custom_attributes_the_fo_attrs_folder"><h2 class="title sectiontitle">Custom attributes: the <span class="ph filepath">fo/attrs</span> folder</h2>
  93. <p class="p">This folder houses custom attribute configuration files that override the standard ones in
  94. <span class="ph filepath">org.dita.pdf2/cfg/fo/attrs</span>. These files define the appearance of different elements in
  95. XML assets when they are rendered to PDF output. The different DITA elements are organized into files by element
  96. type – index-related definitions in <span class="ph filepath">index-attr.xsl</span>, table-related definitions in
  97. <span class="ph filepath">tables-attr.xsl</span>, etc.</p>
  98. <p class="p">The XSL attribute sets defined in these files can be used to override the presentation of DITA elements,
  99. including font size, color, spacing, etc.</p>
  100. </section>
  101. <section class="section" id="pdf-plugin-structure__internationalization_configuration_the_fo_i18n_folder"><h2 class="title sectiontitle">Internationalization configuration: the <span class="ph filepath">fo/i18n</span> folder</h2>
  102. <p class="p">This folder houses custom configuration files that override the standard ones in
  103. <span class="ph filepath">org.dita.pdf2/cfg/fo/i18n</span>. As with index configuration and variable overrides, each file
  104. contains data for a single language, and should take that language’s ISO 639-1 language designator as its name. </p>
  105. <p class="p">Each configuration file contains mappings of certain symbols to the Unicode codepoint which should be used to
  106. represent them in the given locale.</p>
  107. <p class="p">The best way to start editing a custom configuration is by making a copy of the original from
  108. <span class="ph filepath">org.dita.pdf2/cfg/fo/i18n</span> and making changes as desired.</p>
  109. <p class="p">In order to apply a custom configuration to your publishing outputs, edit <span class="ph filepath">catalog.xml</span> and
  110. uncomment the appropriate entry in the “I18N configuration override entries” section.</p>
  111. </section>
  112. <section class="section" id="pdf-plugin-structure__custom_stylesheets_the_fo_xsl_folder"><h2 class="title sectiontitle">Custom stylesheets: the <span class="ph filepath">fo/xsl</span> folder</h2>
  113. <p class="p">This folder houses custom stylesheet files that override the default stylesheets in
  114. <span class="ph filepath">org.dita.pdf2/xsl/fo</span>. </p>
  115. <p class="p">You can use custom stylesheets to implement additional processing routines or adjust the output generated by
  116. the default toolkit processing.</p>
  117. </section>
  118. </div>
  119. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../dev_ref/pdf-customization.html" title="You can create custom DITA-OT plug-ins that build on the default DITA to PDF transformation. Plug-ins can customize covers and page layouts, modify formatting, override logic of the default PDF plug-in, and much more.">Customizing PDF output</a></div></div></nav></article></main></body></html>