Skip to content

Setting page size is unreliable

I'm trying to generate an A5 landscape PDF. I've tried the following:

  • Using size: a5 landscape inside an @page rule in CSS. This produces a portrait US Letter PDF.
  • Using --page-size a5 --landscape on the CLI. (I've also tried A5.) This also produces a portrait US Letter PDF.
  • Using --width 210 --height 148.5 on the CLI. This produces a page that is 39.2 mm wide and 55.8 mm high‽
  • Using --width 793.700787 --height 561.2598 gives me close enough to the size I want, but portrait. Using --height 793.700787 --width 561.2598 gives me the same result. This also applies with --landscape.

It looks like what's happening is:

  • The --page-size CLI arg is being ignored.
  • The --width and --height is being interpreted as 1/96 of an inch (e.g. a CSS "pixel"), even though the --help output says it should be millimetres.
  • The page is always rendered in portrait (e.g. the longest side of the page is always vertical), regardless of which way around --width and --height are or whether --landscape is specified.