The document provides an overview of customizing PDF output from the DITA Open Toolkit. It discusses the FO plugin structure, including attribute sets, stylesheets, and variables files that control processing and element appearance. It also provides examples of customizing aspects like page layout, headers/footers, fonts, and indexes. The goal is to understand how to make predictable, standards-based changes to PDF output without modifying default files.
2. Me, me, me
⢠Background: English, Theoretical Linguistics
⢠NOT a programmer or stylesheet developer
⢠20+ years as a content creator
ElementalSource, LLC
3. Lower your standards?
⢠That dependsâŚ
â Are your standards based onâŚnon-standards?
⢠A tweak here, a tweak there, whatever âlooks rightâ
⢠That is not a standard!
⢠A standard is âan approved modelâ
â Predictable and prescriptive
⢠PDF processing via the OT is absolutely based on
standards
â If you canât capture your âtweakâ with a context-based rule,
itâs not predictable or prescriptiveâdrop it!
ElementalSource, LLC
4. Ask yourselfâŚ
âŚwhich is more important:
â perfect pages
â more time to spend creating quality content
ElementalSource, LLC
5. How does the OT make PDFs?
⢠Uses the FO plug-in
⢠A collection of stylesheets, variables files, build files,
etc. that transform DITA into XSL:FO and then send it to
an FO processor
⢠You never see an actual page until the PDF is done
â This is a COMPLETE mind freak for some people
â And a godsent miracle for others
ElementalSource, LLC
6. FO plug-in
⢠Originally developed to fill in the âhardcopyâ gap
⢠Currently maintained by Suite Solutions
⢠Several folks working on improvements or complete
re-writes
⢠It ainât pretty but it works
ElementalSource, LLC
8. Quick tour of the FO plug-in
⢠DITA-OTdemofo:
ElementalSource, LLC
9. The cfg folder
⢠DITA-OTdemofocfg:
Attribute sets to Images associated
control with the
appearance of customization
elements
Stylesheets to
control Language-specific
processing and variables for
behavior of âboilerplateâ text;
elements header/footer
definitions; note
image paths
ElementalSource, LLC
11. Attribute sets
⢠Grouped by element âtypeâ (lists, links, tables, etc.) or
domain (ui, pr, etc.)
⢠Everything else is in commons-attr.xsl
ElementalSource, LLC
12. Attribute sets
⢠Expect to see the attributes in the default sets
⢠If you customize &
remove attributes,
OT âfills them back
inâ from the default
ElementalSource, LLC
14. Attribute sets
⢠Called by the stylesheets in
DITA-OTdemofoxsl
⢠Use the attribute set name to find the xsl template OR
use the xsl template to find the attribute set
ElementalSource, LLC
15. Attribute sets
⢠Some files are specific to FO processors:
â _axf: Antenna House
â _xep: XEP
â _fop: Apache FOP
ElementalSource, LLC
16. basic-settings.xsl
⢠Variables that define:
â page dimensions
â margins
â default font size
â default line height
⢠Use these variables instead of fixed values in attribute
sets and layout-masters
⢠Add more as needed for greater uniformity
ElementalSource, LLC
17. XSL
⢠Lots of these but many you probably wonât touch
⢠Grouped by element âtypeâ (lists, links, tables, etc.) or
domain (ui, pr, etc.)
â Names match the attribute set files
⢠Everything else is in commons.xsl
â Kitchen sink
ElementalSource, LLC
18. XSL
⢠Some files specific to FO processors:
â _axf: Antenna House
â _xep: XEP
â _fop: Apache FOP
ElementalSource, LLC
19. _1.0 files
⢠Sometimes replace original file:
â bookmarks_1.0.xsl
â front-matter_1.0.xsl
⢠Sometimes supplement original file:
â commons_1.0.xsl
â index_1.0.xsl
â table_1.0.xsl
â toc_1.0.xsl
ElementalSource, LLC
20. root-processing.xsl
⢠Creates the âshellâ for your FO file
⢠Calls other templates for frontmatter, TOC, index, etc.
⢠Creates variables from map metadata that are available
throughout the build in headers, footers, cover pages,
etc.
ElementalSource, LLC
22. Okay, letâs make a PDF!
⢠Multiple ditamaps
⢠Bookmap
⢠ANT build file
â DITA-OTsamplesant_sample
⢠Batch file
â Copy startcmd.bat from DITA-OT
ElementalSource, LLC
23. A couple of quick changes
⢠ANT build file:
â Change FO processor
â Retain the topic.fo file
ElementalSource, LLC
24. Create your own customization
⢠Copy and rename Customization folder
â Donât make changes to the default files!
⢠Rename and edit catalog.xml.orig
⢠Call your customization from your ANT build file
⢠Copy a file into your customization
â commons-attr.xsl
ElementalSource, LLC
25. Create your own customization
⢠In IntellContfoattrs, rename custom.xsl.orig
â Rename the one in IntellContfoxsl, too
⢠Call your commons-attr.xsl from custom.xsl
â <xsl:import href="commons-attr.xsl"/>
⢠Make small, obvious change to commons-attr.xsl and
run build to test
ElementalSource, LLC
27. Add bookmap metadata to cover
⢠Copy root-processing.xsl to your customization
⢠Create variables
â productRev
â bookNo
⢠Copy front-matter_1.0.xsl to your customization
⢠Add fo:block elements that contain variables
ElementalSource, LLC
28. Rearrange info in headers, footers
⢠Copy en.xml to your customization
⢠Copy static-content.xsl to your customization
ElementalSource, LLC
31. Wait!
⢠Page numbers are not on the outside in even footers
⢠basic-settings.xsl:
â <xsl:variable name="mirror-page-margins" select="true()"/>
ElementalSource, LLC
32. Justify footers
⢠static-content.xsl:
â <fo:leader leader-pattern="space"/>
â Be sure to put in right place!
⢠Copy static-content-attr.xsl to your customization
⢠Attribute sets odd__footer, even__footer
â text-align=âjustifyâ
â text-align-last=âjustifyâ
ElementalSource, LLC
33. Set up even, odd body pages
⢠Copy layout-masters.xsl to your customization
â Different path in custom.xsl
⢠Copy layout-masters-attr.xsl to your customization
⢠region-body.odd, region-body.even:
â <xsl:attribute name="background-
color">#ffffc0</xsl:attribute>
⢠region.before, region.after:
â <xsl:attribute name="background-
color">#ffc0ff</xsl:attribute>
ElementalSource, LLC
36. Why are *all* the pagesâŚ
âŚyellow and pink, not just body pages?
⢠By default, all page types call region-body.odd and
region-body.even
⢠You can change this
â Add new attribute sets for each page type
ElementalSource, LLC
37. Restart page numbering
⢠Copy commons.xsl to your customization
⢠startPageNumbering template:
â Comment out xsl:if
⢠processTopicAppendix template:
â Add <xsl:call-template name="startPageNumbering"/>
â (Itâs missing for appendix)
ElementalSource, LLC
38. Add an image to the title page
⢠Background image
â Can also add within flow
⢠layout-masters.xsl:
â Change front-matter-first to use region-
body__frontmatter.first
⢠layout-masters-attr.xsl:
â Create region-body__frontmatter.first
ElementalSource, LLC
39. Change fonts
⢠Copy font-mappings.xml to your customization
⢠Uncomment entry in catalog
⢠Add Verdana to âSansâ
⢠Add Palatino to âSerifâ
⢠Processor-dependent:
â XEP: edit xep.xml
â FOP: edit fop.xconf
â AH: edit font-config.xml
ElementalSource, LLC
40. Format TOC levels
⢠Copy toc.xsl and toc-attr.xsl to your customization
⢠Copy font-weight attribute
â Add different colors for levels
â Useful model for any level-based attribute
ElementalSource, LLC
41. TOC attribute set interaction
⢠__toc__topic__content is overwritten by
â __toc__chapter__content
â __toc__appendix__content
â __toc__part__content
when processing bookmap
⢠Many more examples
ElementalSource, LLC
43. Include +/- levels in TOC
⢠Default is 4
⢠Controlled by tocMaximumLevel
â Defined in topic2fo.xsl, topic2fo_1.0.xsl
â You can hardcode in your customization
⢠toc.xsl:
â <xsl:if test="$topicLevel < $tocMaximumLevel">
â <xsl:if test="$topicLevel < 3">
ElementalSource, LLC
44. Remove the mini-TOC
⢠ANT build file:
â <property name="args.chapter.layout" value="BASIC"/>
ElementalSource, LLC
45. Format index page numbers
⢠Copy index-attr.xsl, index.xsl to your customization
⢠Find index-page-citation-list (in index.xsl)
⢠Put whole xsl:if inside <fo:inline>
⢠Call attribute set __index__page__link
⢠Add attributes to __index__page__link (index-attr.xsl)
ElementalSource, LLC
46. Omit top-level index page #s
⢠In index.xsl:
<xsl:when test="opentopic-index:index.entry">
<!--<xsl:for-each select="child::opentopic-index:refID[last()]">
<fo:inline index-key="{@value}"/>
</xsl:for-each>-->
</xsl:when>
<xsl:otherwise>
...
⢠This is a complete kludge but the list is silentâŚany better
ideas?
ElementalSource, LLC
47. Dynamically scale images
⢠âCreate a chart noteâ
â Image is way too big
⢠commons-attr.xsl
â âimageâ attribute set:
<xsl:attribute name="content-width">scale-to-
fit</xsl:attribute>
<xsl:attribute name="content-height">100%</xsl:attribute>
<xsl:attribute name="width">100%</xsl:attribute>
<xsl:attribute name="scaling">uniform</xsl:attribute>
⢠Watch out for width-height ratios!
ElementalSource, LLC
48. Why didnât IâŚ
âŚTalk more about how to format specific elements?
⢠Because thatâs the easiest thing to do!
â Once you find the correct attribute set, itâs a matter of adding
a new attribute or changing the value of an existing one.
ElementalSource, LLC
54. Other resources
⢠Jarno Elovirta's web-based PDF plug-in generator:
http://dita-generator.appspot.com/pdf-plugin/
⢠Patrick Quinlan's (Ditanauts.org) mypdf plug-in:
http://sourceforge.net/p/mypdf/home/Home/
⢠Suite Solutionsâ DITA-OT webinars:
http://www.suite-sol.com
⢠Custom PDFs from the DITA Open Toolkit, Leigh White
XML Press, 2012
ElementalSource, LLC
55. Contact me
Leigh White
ElementalSource, LLC
elementalsource@gmail.com
678.467.7706
ElementalSource, LLC