Orientation Size

Set the default page layout to A4 portrait with regular margins and control the document layout in the DITA source.

Tip: Setting the page orientation to landscape or decreasing margins is useful if you want to:
  • Insert large table elements
  • Insert large image elements
  • Reduce the number of pages

Overview

Resource location:@import url("https://jorsek.github.io/pdfgen.github.io/styles1.1/modules/layout/orientation_size.css");
Figure 1. Default Page Layout
page orientation default
Figure 2. Selectively Customized Page Layout.
In the following example:
  • “Concept A” is the parent topic of “Concept B” and “Concept C”
  • “Concept A” has the @outputclass="landscape" attribute assigned to the root element
  • “Concept C” has the @outputclass="portrait" attribute assigned to the root element
page orientation landscape

DITA Outputclass Attributes

This module enables you to set the following @outputclass attributes in the DITA source:

landscape_small
To set the A4 landscape body page size with small margins, assign the @outputclass="toc_landscape_small" attribute to the root map element or to the root topic element:
page orientation landscape small
landscape
To set the A4 landscape body page size with regular margins, assign the @outputclass="toc_landscape" attribute to the root map element or to the root topic element:
page orientation landscape
portrait [default]
To set the default A4 portrait body page size with regular margins, assign the @outputclass="toc_portrait" attribute to the root map element or to the root topic element:
page orientation toc portrait
portrait_large
To set the A4 portrait body page size with large margins, assign the @outputclass="toc_portrait_large" attribute to the root map element or to the root topic element:
page orientation toc portrait large
portrait_small
To set the A4 portrait body page size with small margins, assign the @outputclass="toc_portrait_small" attribute to the root map element or to the root topic element:
page orientation toc portrait small
toc_landscape_large
To set the A4 landscape TOC page size with large margins, assign the @outputclass="toc_landscape_large" attribute to the root map element :
page orientation toc landscape large
toc_landscape_small
To set the A4 landscape TOC page size with small margins, assign the @outputclass="toc_landscape_small" attribute to the root map element:
page orientation toc landscape small
toc_landscape
To set the A4 landscape TOC page size with regular margins, assign the @outputclass="toc_landscape" attribute to the root map element:
page orientation toc landscape regular
toc_portrait [default]
To set the default A4 portrait TOC page size with regular margins, assign the @outputclass="toc_portrait" attribute to the root map element:
page orientation toc portrait regular
toc_portrait_large
To set the A4 portrait TOC page size with large margins, assign the @outputclass="toc_portrait_large" attribute to the root map element:
page orientation toc portrait large 2
toc_portrait_small
To set the A4 portrait TOC page size with small margins, assign the @outputclass="toc_portrait_small" attribute to the root map element:
page orientation toc portrait small
Tip: You can assign multiple @outputclass attributes divided by spaces to a single DITA element. For example @outputclass="landscape toc_landscape".

For information on how to assign DITA attributes, see:

Common Customizations

You can apply customizations by pasting the following code snippets under the @import rules.

Change the document body layout
custom body size
You can specify the custom page with:
  • A document format keyword, for example US-Letter.

    See Page Size Keywords.

  • Specific document width and height.

    For example: 920px 920px.

/* Custom document layout. */
@page {
    size: 920px 920px;
}

If you want to override any @outputclass attribute associated with this style, use the following code:

/* Force custom document layout. */
@page {
    size: 920px 920px !important;
}
/* Prevent the default cover page layout from breaking. */
@page cover_page {
    size: a4 portrait !important;
}
Change the table of contents layout
page orientation landscape toc
/* Custom TOC layout. */
@page toc {
    size: A4 landscape;
}
Make the PDF reader zoom to fit page
/* Zoom to fit page after opening */
@prince-pdf {
    prince-pdf-open-action: zoom(fit-page);
}
Change the cover layout
See Cover.