Can DITA templates specify margin sizes and page dimensions?
In DITA, templates can specify margin sizes and page dimensions to control the layout and appearance of printed or PDF output. DITA templates, often created in a tool like the DITA Open Toolkit, allow defining the formatting and layout of content when it is published to print or PDF. Specifying margin sizes and page dimensions is an important aspect of this control.
Margin Sizes:
Margins refer to the empty space around the content on each page. DITA templates enable specifying the size of these margins, including top, bottom, left, and right margins. Margins provide space for headers, footers, and other elements that should not overlap with the content.
Page Dimensions:
Page dimensions define the size of the paper or page on which the content will be printed. These dimensions typically include the paper size (e.g., letter, A4, legal) and page orientation (portrait or landscape).
Customization:
DITA templates can be customized to adhere to specific formatting requirements. For example, narrower margins can be set for a document with limited space, or choose landscape orientation for content that benefits from a wider page.
CSS and XSL-FO:
Cascading Style Sheets (CSS) or Extensible Stylesheet Language Formatting Objects (XSL-FO) are often used to define margin sizes and page dimensions within DITA templates. CSS is typically used for HTML-based output, while XSL-FO is more common for print and PDF output.
Example:
An organization wants to publish a technical manual as a printed document. They can define margin sizes and page dimensions like this in their DITA template:
<print-attributes>
<page-size>letter</page-size> <!-- Specify letter-sized pages -->
<page-width>8.5in</page-width> <!-- Width of the page -->
<page-height>11in</page-height> <!-- Height of the page -->
<top-margin>1in</top-margin> <!-- Top margin size -->
<bottom-margin>1in</bottom-margin> <!-- Bottom margin size -->
<left-margin>1.25in</left-margin> <!-- Left margin size -->
<right-margin>1.25in</right-margin> <!-- Right margin size -->
</print-attributes>
In this example, the template sets the page size to “letter” with specific dimensions and adjusts the margin sizes accordingly. When content is published using this template, it will conform to the specified page dimensions and margins, ensuring a consistent layout for the printed document.