pdf-plugin-structure.dita 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <concept id="pdf-plugin-structure">
  5. <title>PDF plug-in structure</title>
  6. <shortdesc>In cases that require substantial customizations, it is often useful to organize the files in a folder
  7. structure that mimics the hierarchy of the default PDF plug-in. This method facilitates comparisons with the default
  8. settings in the base PDF plug-in and makes it easier to migrate customizations to new toolkit versions.</shortdesc>
  9. <conbody>
  10. <note>For simpler customizations, you may want to structure your plug-in differently, but the information in this
  11. topic may help you to locate the files you need to customize.</note>
  12. <p>The original Idiom plug-in used its own extension mechanism to provide overrides to the PDF transformation. With
  13. this approach, a dedicated folder within the plug-in was used to store customized files. While this method is no
  14. longer recommended, the same organization principles can be used in custom PDF plug-ins.</p>
  15. <p>To begin creating a new custom plug-in, you can copy the <filepath>plugins/org.dita.pdf2/Customization</filepath>
  16. folder to a new folder, such as <filepath>plugins/com.company.pdf</filepath>.</p>
  17. <p>DITA-OT provides template files that you can start with throughout the <filepath>Customization</filepath>
  18. directory structure. These files end in the suffix <codeph>.orig</codeph> (for example,
  19. <filepath>catalog.xml.orig</filepath>). To enable these files, copy them to your custom plug-in and remove the
  20. <codeph>.orig</codeph> suffix. For example, copy <filepath>catalog.xml.orig</filepath> to
  21. <filepath>catalog.xml</filepath>. You can then make modifications to the copy in your custom plug-in folder.</p>
  22. <p>Things you can currently override include:</p>
  23. <ul>
  24. <li>Custom XSL via <filepath>xsl/custom.xsl</filepath> and <filepath>attrs/custom.xsl</filepath></li>
  25. <li>Layout overrides via <filepath>layout-masters.xsl</filepath></li>
  26. <li>Font overrides via <filepath>font-mappings.xml</filepath></li>
  27. <li>Per-locale variable overrides via <filepath>common/vars/[language].xml</filepath></li>
  28. <li>I18N configuration via <filepath>i18n/[language].xml</filepath></li>
  29. <li>Index configuration via <filepath>index/[language].xml</filepath></li>
  30. </ul>
  31. <p>When customizing any of these areas, modify the relevant file(s) in your custom plug-in folder. Then, to enable
  32. the changes in the publishing process, you find the corresponding entry for each file you modified in the
  33. <filepath>catalog.xml</filepath> file.</p>
  34. <p>It should look like this:</p>
  35. <codeblock>&lt;!--uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/--&gt;</codeblock>
  36. <p>Remove the comment markers <codeph>!--</codeph> and <codeph>--</codeph> to enable the change:</p>
  37. <codeblock>&lt;uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/&gt;</codeblock>
  38. <p>Your customization should now be enabled as part of the publishing process.</p>
  39. <p>When your custom plug-in is installed, the files in its subfolders will override the out-of-the-box settings from
  40. their counterparts in <filepath>org.dita.pdf2/cfg/fo/attrs</filepath> and
  41. <filepath>org.dita.pdf2/xsl/fo</filepath>.</p>
  42. <section id="custom_artwork_the_common_artwork_folder">
  43. <title>Custom artwork: the <filepath>common/artwork</filepath> folder</title>
  44. <p>This folder houses custom artwork files that override the standard ones in
  45. <filepath>org.dita.pdf2/cfg/common/artwork</filepath>. These files are used to graphically identify different
  46. types of DITA <xmlelement>note</xmlelement> element.</p>
  47. <p>The mapping between <xmlelement>note</xmlelement> type and graphic is contained in a subset of the
  48. locale-dependent variable files, such as</p>
  49. <codeblock>cfg/common/vars</codeblock>
  50. <p>The variables that control <xmlelement>note</xmlelement> graphics all follow the form</p>
  51. <codeblock> &lt;variable id="{type} Note Image Path"&gt; {Path to image file} &lt;/variable&gt;</codeblock>
  52. <p>where {type} contains a possible value for the <xmlelement>note</xmlelement>
  53. <xmlatt>type</xmlatt> attribute.</p>
  54. </section>
  55. <section id="index_configuration_the_common_index_folder">
  56. <title>Index configuration: the <filepath>common/index</filepath> folder</title>
  57. <p>This folder houses custom index definition files that override the standard ones in
  58. <filepath>org.dita.pdf2/cfg/common/index</filepath>. Each file contains data for a single language, and should
  59. take that language’s ISO 639-1 language designator as its name (for example, <filepath>pt.xml</filepath> for
  60. Portuguese). If necessary, locale-specific customizations can be provided by adding a region designator to the
  61. file name (for example, <filepath>pt_BR.xml</filepath> for Brazilian Portuguese).</p>
  62. <p>The index files consist of <xmlelement>index.group</xmlelement> elements which contain sorting information on
  63. one or more characters. Index groups are listed in sort order (“specials” before numbers, numbers before the
  64. letter ‘A‘, etc), and the <xmlelement>char.set</xmlelement> entries they contain are also listed in sort order
  65. (uppercase before lowercase).</p>
  66. <p>The best way to start editing a custom index file is by making a copy of the original from
  67. <filepath>org.dita.pdf2/cfg/common/index</filepath> and making changes as desired.</p>
  68. <p>In order to apply a custom index definition to your publishing outputs, edit <filepath>catalog.xml</filepath>
  69. and uncomment the appropriate entry in the “Index configuration override entries” section.</p>
  70. </section>
  71. <section id="variable_overrides_the_common_vars_folder">
  72. <title>Variable overrides: the <filepath>common/vars</filepath> folder</title>
  73. <p>This folder houses custom variable definitions that override the standard ones in
  74. <filepath>org.dita.pdf2/cfg/common/vars</filepath>. As with index configuration, Each file contains data for a
  75. single language, and should take that language’s ISO 639-1 language designator as its name.</p>
  76. <p>Variable files contain a set of <xmlelement>variable</xmlelement> elements, identified by their
  77. <xmlatt>id</xmlatt> attribute. The variable definitions are used to store static text that is used as part of
  78. the published outputs. For example, page headers, hyperlinks, etc. The id attribute for each variable should
  79. make it clear how the variable text is being used.</p>
  80. <p>Some variables contain <xmlelement>param</xmlelement> elements which indicate parameter values that are
  81. substituted at publish time by the XSL. For example, a page number that is being generated as part of the
  82. publishing process might be identified by &lt;param ref-name="number"/&gt; When editing or translating a
  83. variable file, these should be included in the translation, though they can be moved and rearranged within the
  84. <xmlelement>variable</xmlelement> content as needed.</p>
  85. <p>The best way to start editing a custom variables file is by making a copy of the original from
  86. <filepath>org.dita.pdf2/cfg/common/vars</filepath> and making changes as desired. When adding a new language,
  87. start from an existing language’s list of variables and translate each entry as needed.</p>
  88. <p>Note that unchanged <xmlelement>variable</xmlelement> elements can be omitted: the custom variables file need
  89. only include those <xmlelement>variable</xmlelement> elements which you have modified. Variables not found in
  90. the custom file will are taken from the standard variable files.</p>
  91. <p>Applying a custom variable does not require modifying the <filepath>catalog.xml</filepath> file. The publishing
  92. process will automatically use any custom variables definitions in place of the original ones.</p>
  93. </section>
  94. <section id="custom_attributes_the_fo_attrs_folder">
  95. <title>Custom attributes: the <filepath>fo/attrs</filepath> folder</title>
  96. <p>This folder houses custom attribute configuration files that override the standard ones in
  97. <filepath>org.dita.pdf2/cfg/fo/attrs</filepath>. These files define the appearance of different elements in
  98. XML assets when they are rendered to PDF output. The different DITA elements are organized into files by element
  99. type – index-related definitions in <filepath>index-attr.xsl</filepath>, table-related definitions in
  100. <filepath>tables-attr.xsl</filepath>, etc.</p>
  101. <p>The XSL attribute sets defined in these files can be used to override the presentation of DITA elements,
  102. including font size, color, spacing, etc.</p>
  103. </section>
  104. <section id="internationalization_configuration_the_fo_i18n_folder">
  105. <title>Internationalization configuration: the <filepath>fo/i18n</filepath> folder</title>
  106. <p>This folder houses custom configuration files that override the standard ones in
  107. <filepath>org.dita.pdf2/cfg/fo/i18n</filepath>. As with index configuration and variable overrides, each file
  108. contains data for a single language, and should take that language’s ISO 639-1 language designator as its name. </p>
  109. <p>Each configuration file contains mappings of certain symbols to the Unicode codepoint which should be used to
  110. represent them in the given locale.</p>
  111. <p>The best way to start editing a custom configuration is by making a copy of the original from
  112. <filepath>org.dita.pdf2/cfg/fo/i18n</filepath> and making changes as desired.</p>
  113. <p>In order to apply a custom configuration to your publishing outputs, edit <filepath>catalog.xml</filepath> and
  114. uncomment the appropriate entry in the “I18N configuration override entries” section.</p>
  115. </section>
  116. <section id="custom_stylesheets_the_fo_xsl_folder">
  117. <title>Custom stylesheets: the <filepath>fo/xsl</filepath> folder</title>
  118. <p>This folder houses custom stylesheet files that override the default stylesheets in
  119. <filepath>org.dita.pdf2/xsl/fo</filepath>. </p>
  120. <p>You can use custom stylesheets to implement additional processing routines or adjust the output generated by
  121. the default toolkit processing.</p>
  122. </section>
  123. </conbody>
  124. </concept>