layout_grid() calculates a layout data frame
for a grid of identically sized print-and-play components.
Usage
layout_grid(
nrow = 2L,
ncol = 1L,
width = 2.5,
height = 3.5,
bleed = 0,
...,
paper = getOption("papersize", "letter"),
orientation = c("landscape", "portrait"),
angle = 0,
name = layout_name_fn(),
direction = "left-to-right",
input = NULL,
pages = "all"
)Arguments
- nrow, ncol
Number of rows and columns of print-and-play components (e.g. cards)
- width, height, bleed
Width, height, and bleed for each print-and-play component (in inches)
- ...
Ignored.
- paper, orientation
Print-and-play paper size and orientation.
paperdefaults togetOption("papersize", "letter")unlessinputis passed.- angle
Vector of angles of the pieces in degrees (counter-clockwise) (assigned
direction, top-to-bottom)- name
Either a vector of names of each piece or a function with arguments
nrowandncolto be used to generate a vector of names for each piece. These will be assigneddirection, top-to-bottom.layout_name_fn()can be used to generate such a function.- direction
Should
nameandanglebe assigned "left-to-right" or "right-to-left". Also supports aliases "ltr", "lr", "rtl", and "rl".- input
If not
NULLthen an input pdf filename whose (selected) pages' paper size as inferred bypdf_paper()is used aspaper. Onlypaperis inferred frominput: for the layout to be centered on the actual pagesorientationmust also match them. It is an error to pass bothinputandpaper, to passpageswithoutinput, or if the selected pages don't all share a supported paper size.- pages
Which pages of
inputto infer the paper size from. Supports the same values as thepagesargument ofpdf_apply()e.g."all","even","odd", or a numeric vector. It is an error if no pages are selected.
Value
A data frame with columns "row", "col", "x", "y", "angle", "width", "height", "bleed", "paper", "orientation", and "name".
Examples
# Button Shy card layout
layout_grid(nrow = 2L, ncol = 3L, height = 3.447, width = 2.469, bleed = 0.125)
#> row col x y angle width height bleed paper orientation name
#> 1 1 1 2.781 6.0985 0 2.469 3.447 0.125 letter landscape piece.1
#> 2 1 2 5.500 6.0985 0 2.469 3.447 0.125 letter landscape piece.2
#> 3 1 3 8.219 6.0985 0 2.469 3.447 0.125 letter landscape piece.3
#> 4 2 1 2.781 2.4015 0 2.469 3.447 0.125 letter landscape piece.4
#> 5 2 2 5.500 2.4015 0 2.469 3.447 0.125 letter landscape piece.5
#> 6 2 3 8.219 2.4015 0 2.469 3.447 0.125 letter landscape piece.6
# Center the layout on the paper size of a pdf's pages
input <- pdf_create_blank(paper = "a4", orientation = "portrait")
layout_grid(nrow = 3L, ncol = 3L, orientation = "portrait", input = input)
#> row col x y angle width height bleed paper orientation name
#> 1 1 1 1.633858 9.346457 0 2.5 3.5 0 a4 portrait piece.1
#> 2 1 2 4.133858 9.346457 0 2.5 3.5 0 a4 portrait piece.2
#> 3 1 3 6.633858 9.346457 0 2.5 3.5 0 a4 portrait piece.3
#> 4 2 1 1.633858 5.846457 0 2.5 3.5 0 a4 portrait piece.4
#> 5 2 2 4.133858 5.846457 0 2.5 3.5 0 a4 portrait piece.5
#> 6 2 3 6.633858 5.846457 0 2.5 3.5 0 a4 portrait piece.6
#> 7 3 1 1.633858 2.346457 0 2.5 3.5 0 a4 portrait piece.7
#> 8 3 2 4.133858 2.346457 0 2.5 3.5 0 a4 portrait piece.8
#> 9 3 3 6.633858 2.346457 0 2.5 3.5 0 a4 portrait piece.9
unlink(input)