Page Size Fallback

In Pagination and Margins, you learned how to set a page size for the document. But what if the contents of the document are too wide for the specified page size? What if, no matter how hard Highwire™ tries to reformat the document, there are tables or other elements that can't fit in a single page?

In situations like this, Highwire's default behavior is to widen the page just enough so that the contents fit on the page. When a printer tries to print the document, it then scales the entire page down to the size of the paper it is printing on. This way, no content is lost. However, there may be circumstances where the scaling of the page may be undesirable.

If such behavior is undesirable, Highwire allows you to take control of how it resizes pages in such circumstances, using page size fallback schemes. Highwire's page size fallback scheme allows you to provide Highwire with a list of page definitions. Highwire tries to fit the document's contents in the first page definition, but uses the second definition if the contents grow too big. It falls back to a third definition if the first two don't work, and so on. Each definition allows you to specify a page size, margin settings, and a page orientation.

For instance, specify a Letter sized page by default, but you want to rotate the page to landscape if you need to have more room. Or if that fails, you can add a third page definition that specifies that the document should grow to 11x17, or some other standard size. You can even provide a fourth definition that made it so that the margins were smaller.

Page Definition Format

As described in Pagination and Margins, the <body> tag lets you change settings like page size and margins by editing them in the Web document. Unfortunately, this method of changing the page size is not flexible enough for fallback schemes. Rather, use the Highwire special <ctpagedef> tag.

This tag takes just one attribute: style. Use the <ctpagedef> tag's style attribute to insert all of the page formatting styles, as described in Pagination and Margins. The code below shows an example <ctpagedef> tag:

<ctpagedef style="page-size:A5; page-margin:1in; page-margin-left:1.25in; page-margin-right:1.25in; page-orientation:portrait"/>

Specifying the Fallback Scheme

To specify an actual fallback scheme, list any number of <ctpagedef> page definitions inside of a <ctpagedefs> tag in the <head> section of the Web document. The <ctpagedefs> tag can also be used to provide a page size fallback scheme in a linked Highwire template file or in Corda Server's default Highwire template file (see Highwire Template Files and Default Highwire Template File).

Note: Only one <ctpagedefs> tag applies per document, so a scheme listed in the <head> section of a document takes precedence over a scheme in a linked template file, and a scheme in a linked template file takes precedence over a scheme in the Corda Server's default template.

The code below shows what a page size fallback scheme might look like.

Page size fallback

<ctpagedefs>

<ctpagedef style="page-size:A5; page-margin:1in; page-margin-left:1.25in; page-margin-right:1.25in;"/>

<ctpagedef style="page-size:A5; page-margin:.5in"/>

<ctpagedef style="page-size:A5; page-orientation:landscape; page-margin:1in"/>

<ctpagedef style="page-size-width:8.5in; page-size-height:10.5in; page-margin:1in"/>

<ctpagedef style="page-size:11x17; page-margin:1in"/>

</ctpagedefs>

Note: The 11 x 17 paper size, sometimes called LEDGER, is in a landscape orientation by default. This means that setting the page orientation to landscape actually causes the page to appear in a portrait layout.