Skip to contents

pdf_width() and pdf_height() get the dimensions of the pdf file pages. The page size is read before any /Rotate page attribute is applied so pages a pdf viewer displays rotated by 90 or 270 degrees are reported with their unrotated width and height. Processing the pdf with pdf_gs() first bakes any such rotation into the page size so the displayed dimensions are reported.

Usage

pdf_width(input, ..., units = "inches", numeric = FALSE)

pdf_height(input, ..., units = "inches", numeric = FALSE)

Arguments

input

Input pdf filename.

...

Ignored.

units

Units to use. See grid::unit().

numeric

If TRUE return numeric else a grid::unit() object.

Value

If numeric = TRUE a numeric vector else a grid::unit() object.

Examples

f <- pdf_create_blank(width = 8.5, height = 11)
pdf_width(f)
#> [1] 8.5inches
pdf_height(f, units = "cm")
#> [1] 27.94cm
pdf_height(f, units = "mm", numeric = TRUE)
#> [1] 279.4
unlink(f)