Set page size in pdfChip

The PDF page size can be specified inside the CSS @page{} rule. The size CSS descriptor, used inside the @page rule, sets the dimensions and orientation of the box which is used to represent a page. If no @page rule is defined A4 will be used as default.

CSS Syntax for @page

The size can be defined by a keyword (e.g. A4) or by absolute dimensions. Below are some examples of @page rules to set the page size in pdfChip.

1 value: height = width

@page {
  size: 6in;
}


@page {
  size: 50mm;
}
Click to copy

2 values: width then height

@page {
  size: 4in 6in;
}


@page {
  size: 50mm 150mm;
}
Click to copy

Keyword values for absolute size

Any of the following values: A4, A5, A3, B5, B4, letter (8.5in x 11in), legal (8.5in x 14in), ledger (11in x 17in)

@page {
  size: A4;
}


@page {
  size: letter;
}
Click to copy

Combination of size and orientation

@page {
  size: A4 landscape;
}

@page {
  size: B5 portrait;
}
Click to copy

Setting the page size on the CLI

The earliest version with full support for --force-page-size and --default-page-size is pdfChip 2.6.094.

To set the page size of a PDF on the command line, one of the following arguments can be used:

Set the default page size

If no page size is specified in the CSS @page{} rule, A4 will be used as default size. To change the default value for the page size to a specified value, the following command line argument can be used:

--default-page-size="CSS syntax for @page"
Click to copy

Override the page size set in @pages

If a page size is set in the CSS @page{} rule but needs to be overridden, the command-line argument --force-page-size can be used (this will set the page size even if @page rule does specify a page size):

--force-page-size="CSS syntax for @page"
Click to copy