Skip to contents

Use the "paper" parameter (matching name from paper_sizes), standard (optionally including series and size) parameter, or width, height and units. May return multiple paper sizes depending on parameters.

Usage

get_paper(
  paper = "letter",
  orientation = "portrait",
  standard = NULL,
  series = NULL,
  size = NULL,
  width = NULL,
  height = NULL,
  units = NULL,
  cols = 1,
  rows = 1,
  gutter = 0,
  bbox = NULL,
  margin = NULL,
  ...
)

Arguments

paper

Paper, Default: 'letter'.

orientation

Orientation "portrait", "landscape", or "square", Default: 'portrait'.

standard

Size standard, "ANSI", "ISO", "British Imperial", "JIS", "USPS", "Facebook", "Instagram", or "Twitter".

series

Size series (e.g. A), Default: NULL

size

Size number (only used for "ISO" and "JIS" series). Standard, series, and size may all be required to return a single paper when using these parameters.

width, height

Width and height in units, Default: NULL.

units

Paper size units, either "in", "mm", or "px"; defaults to NULL (using "in" if width or height are provided).

cols, rows

Number of expected columns and rows in paper; used to determine row_height and section_asp in paper data frame returned by get_paper if rows or cols is greater than 1; defaults to NULL.

gutter

Gutter distance in units. Gutter is used as the spacing between rows and columns (variable spacing is not currently supported); defaults to 0.

bbox

A bounding box to use to get orientation using sf_bbox_asp() with orientation = TRUE.

margin

Margin style (options include "extrawide", "wide", "standard", "narrow", "none"), Additional "auto" option to generate margin based on line length is planned but not yet implemented. Default: NULL (equivalent to "none").

...

Additional parameters passed to get_margin. plot_width can only be passed in these parameters if paper has only a single row. margin is returned as a list column.

Value

Data frame with one or more paper/image sizes.

Details

If margin is provided, a block_width, block_height, and block_asp are calculated and included as columns in the returned data frame.

Paper can also be a data frame with "width", "height", "orientation", and "units" columns.

Examples

get_paper("letter")
#> # A tibble: 1 × 16
#>   name   series size  standard units width height   asp  cols col_width  rows
#>   <chr>  <chr>  <chr> <chr>    <chr> <dbl>  <dbl> <dbl> <dbl>     <dbl> <dbl>
#> 1 Letter NA     NA    ANSI     in      8.5     11 0.773     1       8.5     1
#> # … with 5 more variables: row_height <dbl>, gutter <dbl>, section_asp <dbl>,
#> #   orientation <chr>, type <chr>
#> # ℹ Use `colnames()` to see all variable names

get_paper(paper = NULL, standard = "ISO", series = "A", size = 4)
#> # A tibble: 1 × 16
#>   name  series size  standard units width height   asp  cols col_width  rows
#>   <chr> <chr>  <chr> <chr>    <chr> <dbl>  <dbl> <dbl> <dbl>     <dbl> <dbl>
#> 1 A4    A      4     ISO      mm      210    297 0.707     1       210     1
#> # … with 5 more variables: row_height <dbl>, gutter <dbl>, section_asp <dbl>,
#> #   orientation <chr>, type <chr>
#> # ℹ Use `colnames()` to see all variable names

get_paper(width = 11, height = 17)
#> # A tibble: 1 × 16
#>   name   series size  standard units width height   asp  cols col_width  rows
#>   <chr>  <chr>  <chr> <chr>    <chr> <dbl>  <dbl> <dbl> <dbl>     <dbl> <dbl>
#> 1 Letter NA     NA    ANSI     in      8.5     11 0.773     1       8.5     1
#> # … with 5 more variables: row_height <dbl>, gutter <dbl>, section_asp <dbl>,
#> #   orientation <chr>, type <chr>
#> # ℹ Use `colnames()` to see all variable names