Pages

Unlike emails and web pages, Print sections can contain multiple pages. Pages are naturally limited by their size and margins. If the content of a section doesn't fit on one page, the overflow goes to the next page. This happens automatically, based on the section's page size and margins; see Page settings: size, margins and bleed.
The minimum number of pages can be set via the Print section properties; see Print section properties.

Although generally the same content elements can be used in all three contexts (see Content elements), the specific characteristics of pages make it possible to use special elements, such as page numbers; see Page numbers .

The widow/orphan setting lets you control how many lines of a paragraph stick together, when content has to move to another page; see Preventing widows and orphans. You can also avoid or force a page break before or after an entire element, see Page breaks.

Each page in a print section has a natural position: it is the first page, the last page, a 'middle' page (a page between the first and the last page) or a single page. For each of those positions, a different Master Page and Media can be set. A Master Page functions as a page's background, with for example a header and footer. A Media represents preprinted paper that a page can be printed on. See Master Pages and Media.

Page specific content elements

The specific characteristics of pages make it possible to use these special elements:

  • Page numbers can only be used in a Print context. See Page numbers to learn how to add and change them.

  • Conditional content and dynamic tables, when used in a Print section, may or may not leave an empty space at the bottom of the last page. To fill that space, if there is any, an image or advert can be used as a whitespace element; see Whitespace elements: using optional space at the end of the last page.

  • Dynamic Tables can be used in all contexts, but transport lines are only useful in a Print context; see Dynamic Table.

Positioning and aligning elements

Sometimes, in a Print template, you don't want content to move up or down with the text flow. To prevent that, put that content in a Positioned Box. See Content elements.

When it comes to positioning elements on a page, Guides can be useful, as well as Tables. See How to position elements.

Page settings: size, margins and bleed

On paper, whether it is real or virtual, content is naturally limited by the page size and margins.

These, as well as the bleed, are set per Print section, as follows:

  • On the Resources pane, right-click a section in the Print context and click Properties.

For the page size, click the drop-down to select a page size from a list of common paper sizes. Changing the width or height automatically sets the page size to Custom.

Margins define where your text flow will go. Static elements can go everywhere on a page, that is to say, within the printable space on a page that depends on the printer.

The bleed is the printable space around a page. It can be used on some printers to ensure that no unprinted edges occur in the final trimmed document. Note: Printers that can’t print a bleed, will misinterpret this setting. Set the bleed to zero to avoid this.

Tip: By default, measurements settings are in inches (in). You could also type measures in centimeters (add 'cm' to the measurement, for example: 20cm) or in millimeters (for example: 150mm).
To change the default unit for measurement settings to centimeters or millimeters: on the menu, select Window > Preferences > Print > Measurements.

Whitespace elements: using optional space at the end of the last page

Print sections with conditional content and dynamic tables (see Personalizing content) can have a variable amount of space at the bottom of the last page. It is useful to fill the empty space at the bottom with transpromotional material, but of course you don’t want extra pages created just for promotional data. 'Whitespace elements' are elements that will only appear on the page if there is enough space for them.

To convert an element into a whitespace element:

  1. Import the promotional image or snippet; see Images and Snippets.

  2. Insert the promotional image or snippet in the content.

    Note:

    • Only a top-level element (for example, a paragraph that is not inside a table or div) can function as a whitespace element.
    • Do not place the promotional image or snippet inside an absolute positioned box. Whitespacing only works for elements that are part of the text flow, not for absolute-positioned boxes.

  3. Select the image or the element that holds the promotional content: click it, or use the breadcrumbs, or select it on the Outline tab; see Selecting an element.

  4. On the Attributes pane, check the option Whitespace element.

  5. (Optional.) Add extra space at the top of the element: on the menu Format, click the option relevant to the selected element (Image for an image, Paragraph for a paragraph, etc.) and adjust the spacing (padding and/or margins).
    Do not add an empty paragraph to provide space between the whitespace element and the variable content. The extra paragraph would be considered content and could end up on a separate page, together with the whitespace element.

    Tip: To always align the whitespace element to the bottom of the page, select it, and type alignbottom in the Class field on the Attributes pane.

Page numbers

Inserting page numbers

Page numbers can be added to a Print section, but they are usually added to a Master Page, because headers and footers are designed on Master Pages; see also: Master Pages.

To insert a page number, select Insert > Special character > Markers on the menu, and then click one of the options to decide with what kind of page number the marker will be replaced:

  • Page number: The current page number in the document. If a page is empty or does not display a page number, it is still added to the page count.

  • Page count: The total number of pages in the document, including pages with no contents or without a page number.

  • Content page number: The current page number in the document, counting only pages with contents that are supplied by the Print section. A page that has a Master Page (as set in the Sheet Configuration dialog, see Applying a Master Page to a page in a Print section) but no contents, is not included in the Content page count.

  • Content page count: This is the total number of pages in the current document that have contents, supplied by the Print section. A page that has a Master Page but no contents, is not included in the Content page count.

  • Sheet number: The current sheet number in the document. A sheet is a physical piece of paper, with two sides (or pages). This is equivalent to half the page number, for example if there are 10 pages, there will be 5 sheets.

  • Sheet count: This marker is replaced by the total number of sheets in the document, whether or not they have contents.

Note: When a marker is inserted, a class is added to the element in which the marker is inserted. Do not delete that class. It enables the software to quickly find and replace the marker when generating output. The respective classes are: pagenumber, pagecount, contentpagenumber, contentpagecount, sheetnumber, and sheetcount.

Tip: Instead of page numbers, you might want to display the current record index and/or the total number of records in the record set, in the document. There is a How-to that explains how to do that: How to get the record index and count.

Creating a table of contents

A table of contents can only be created in a script.
If you are looking to create a short, simple table of contents in one section, you could add a Standard Script that uses the pageRef() function. For an example, see pageref().
For a multi-page, cross-section table of contents you must use a Post Pagination Script; see Creating a Table Of Contents.

The basics of script-writing in the Designer are explained in the following topic: Writing your own scripts.

Configuring page numbers

By default the page numbers are Arabic numerals (1, 2, 3, etc.) without leading zeros nor prefix, and page numbering starts with page 1 for each section. But this can be changed. To do that:

  1. On the Resources pane, right-click a section in the Print context and click Numbering.

  2. Uncheck Restart Numbering if you want the page numbers to get consecutive page numbers, instead of restarting the page numbering with this section.

    Note: Even if a section is disabled, so it doesn't produce any output, this setting is still taken into account for the other sections. This means that if Restart Numbering is checked on a disabled section, the page numbering will be restarted on the next section.
    Disabling a section can only be done in a Control Script (see Control Scripts). Control Scripts can also change where page numbers restart.

  3. Use the Format drop-down to select uppercase or lowercase letters or Roman numerals instead of Arabic numerals.

  4. In Leading Zeros, type zeros to indicate how many digits the page numbers should have. Any page number that has fewer digits will be preceded by leading zeros.

  5. Type the Number prefix. Optionally, check Add Prefix to Page Counts, to add the prefix to the total number of pages, too.

  6. Close the dialog.

Preventing widows and orphans

Widows and orphans are lines at the beginning or at the end of a paragraph respectively, dangling at the bottom or at the top of a page, separated from the rest of the paragraph.
By default, to prevent orphans and widows, lines are moved to the next page as soon as two lines get separated from the rest of the paragraph. The same applies to list items (in unordered, numbered and description lists).
The number of lines that should be considered a widow or orphan can be changed for the entire Print context, per paragraph and in tables.

Note: Widows and orphans are ignored if the page-break-inside property of the paragraph is set to avoid; see Preventing a page break.

In the entire Print context

To prevent widows and orphans in the entire Print context:

  1. On the menu, select Edit > Stylesheets.

  2. Select the Print context.

  3. Click New (or, when there are already CSS rules for paragraphs, click the selector p and click Edit).

  4. Click Format.

  5. After Widows and Orphans, type the minimum number of lines that should be kept together.

Alternatively, manually set the set the widows and orphans properties in a style sheet:

  1. Open the style sheet for the Print context: on the Resources pane, expand the Styles folder and double-click context_print_styles.css.

  2. Add a CSS rule, like the following:

    p { widows: 4; orphans: 3 }

Per paragraph

To change the widow or orphan setting for one paragraph only:

  1. Open the Formatting dialog. To do this, you can:

    • Select the paragraph using the breadcrumbs or the Outline pane (next to the Resources pane) and then select Format > Paragraph in the menu.

    • Right-click the paragraph and select Paragraph... from the contextual menu.

  2. After Widows and Orphans, type the minimum number of lines that should be kept together.

In tables

The CSS properties widows and orphans can be used in tables to prevent a number of rows from being separated from the rest of the table.

Dynamic Tables are automatically divided over several pages when needed. A Standard Table doesn't flow over multiple pages by default. Splitting a Standard Table over multiple pages requires setting the Connect-specific data-breakable attribute on all of its rows. You can either open the Source tab, or write a script to replace each <tr> with <tr data-breakable="">. Note that the effect will only be visible in Preview mode.

To set the number of widows and orphans for a table:

  1. Open the Formatting dialog. To do this, you can:

    • Select the table using the breadcrumbs or the Outline pane (next to the Resources pane) and then select Format > Table in the menu.

    • Right-click the paragraph and select Table... from the contextual menu.

  2. After Widows and Orphans, type the minimum number of table rows that should be kept together.

Page breaks

A page break occurs automatically when the contents of a section don't fit on one page.

Note: Improved page breaking in Connect 2019.1 might impact upon templates made with earlier versions. See Known Issues.

Inserting a page break

To insert a page break before or after a certain element, set the page-break-before property or the page-break-after property of that element (a paragraph for example; see also Styling text and paragraphs):

  1. Select the element (see Selecting an element).

  2. On the Format menu select the respective element to open the Formatting dialog.

  3. In the Breaks group, set the before or after property.

    • Before: Sets whether a page break should occur before the element. This is equivalent to the page-break-before property in CSS; see MDN Web Docs - page-break-before for an explanation of the available options.

    • After: Sets whether a page break should occur after the element. Equivalent to the page-break-after property in CSS; see MDN Web Docs - page-break-after for an explanation of the available options.

Click the button Advanced to add CSS properties and values to the inline style tag directly.
Alternatively you could set this property on the Source tab in the HTML (for example: <h1 style="page-break-before: always;">), or add a rule to the style sheet; see Styling your templates with CSS files.

Note: You cannot use these properties on an empty <div> or on absolute-positioned elements.

Preventing a page break

To prevent a page break inside a certain element, set the page-break-inside property of that element to avoid:

  • Select the element (see Selecting an element).

  • On the Format menu, select the respective element to open the Formatting dialog.

  • In the Breaks group, set the inside property to avoid, to prevent a page break inside the element. For an explanation of all available options of the page-break-inside property in CSS, see MDN Web Docs - page-break-inside.

Alternatively you could set this property on the Source tab in the HTML (for example: <ul style="page-break-inside: avoid;">), or add a rule to the style sheet; see Styling your templates with CSS files.

Adding blank pages to a section

How to add a blank page to a section is described in a how-to: Create blank page on field value.