Skip to content

Page formating

Zulko edited this page Jun 23, 2018 · 2 revisions

Special page formating

Page width and Height

In Chromium, which is used by ReLaXed to print the PDF, there is a different between the page size, specified by the CSS @page {} directive, which defines the size of the printed page, and the "paper size" which is specified during the javascript call to print the page, and refers to the size of the paper on which the page is printed.

The paper size can be indicated to ReLaXed from the (S)CSS code via the -relaxed-page-width and -relaxed-page-height parameters. When your paper size and page size are equal (which would normally be the case), your page definition will look like this:

$page_width: 4in;
$page_height: 7in;

@page {
  size: $page_width $page_height;
  -relaxed-page-width: $page_width;
  -relaxed-page-height: $page_height;
  margin: 15mm 10mm 15mm 10mm;
}

Page Footer and Header

Warning: This gives the syntax for version >0.1.4.

ReLaXed lets you define page headers and footers as follows:

h1 My document
p some paragraph

template#page-header
  p I appear at the top of the page

template#page-footer
  p I appear at the bottom of the page
Clone this wiki locally