-
Notifications
You must be signed in to change notification settings - Fork 2
Page Headers and Footers
First of all, take a look the following image that shows page headers for a PDF generated by the DITA-OT processor without any customization.
Notice that the chapter title and page number are generated on the page header, in the top-right corner, and they are separated with '|' characters.
You can analyze the default implementation by looking at the org.dita.pdf2/xsl/fo/static-content.xsl
stylesheet.
For our customization, we modified the static content generation to do the following:
- Display the chapter title and page number in the page footer.
- Render the chapter title on the left side and page number on the right side.
- Omit the chapter title from the first page since it is already displayed in the center of the page.
You can view all of these customizations by looking at the com.oxygenxml.pdf2.ug/Customization/fo/xsl/static-content.xsl stylesheet.
The PDF produced by the default DITA-OT PDF transformation uses a double-sided page numbering style. This means that chapters will always start on odd numbered pages and blank pages will be added when a chapter does not end on an even page number.
This behavior is useful when you want to print a PDF book, but it can be annoying when you publish the PDF only to be read electronically with a PDF reader application.
This behavior is implemented in XSL-FO by setting the force-page-count="even"
attribute on the fo:page-sequence
element.
To see the default implementation, search for the __force__page__count
attribute set
in the org.dita.pdf2/cfg/fo/attrs/commons-attr.xsl
stylesheet.
In our customization, we set the force-page-count attribute to auto so that no blank pages are produced. See the implementation in: Customization/fo/attrs/commons-attr.xsl.
We decided to use two different styles for page numbering. In the first part of the user manual that includes the Table of Contents, we used Roman numerals, but for the rest of the manual, we reset it to use Arabic digits.
To reset the page numbers in XSL-FO, the initial-page-number
attribute should be specified on the fo:page-sequence
element.
See the entire customization in the startPageNumbering
template from the com.oxygenxml.pdf2.ug/Customization/fo/xsl/commons.xsl stylesheet.
Related information:
- [XSL, XSL-FO FAQ, Page Numbering] (http://www.dpawson.co.uk/xsl/sect3/N8703.html)