Skip to contents

pdf_add_crosshairs() adds crosshairs to the corners of components of a print-and-play layout.

Usage

pdf_add_crosshairs(
  input,
  output = NULL,
  ...,
  layout = "button_shy_cards",
  gp = gpar(),
  ch_width = unit(1/6, "in"),
  ch_grob = NULL
)

Arguments

input

Input pdf filename.

output

Output pdf filename. NULL defaults to a tempfile() with a ___pnpmisc.pdf file extension.

...

Passed to pdf_add_overlay().

layout

Either a layout preset name in layout_names() or a data frame with layout data (as returned by layout_grid()). A preset name is centered on the paper size of the input pdf's (selected) pages as inferred by pdf_paper(); it is an error if those pages don't all share a supported paper size.

gp, ch_width, ch_grob

Passed to piecepackr::grid.crosshair(). ch_grob defaults to piecepackr::squaresCrosshairGrob().

Value

output pdf file name invisibly. As a side effect adds crosshairs to a pdf.

Details

  • The default layout supports Button Shy games.

Examples

if (requireNamespace("piecepackr", quietly = TRUE) &&
    utils::packageVersion("piecepackr") >= "1.14.0-5") {
  input <- pdf_create_blank(length = 2L, orientation = "landscape")
  output <- pdf_add_crosshairs(input, pages = "odd", dpi = 75,
                               layout = "button_shy_cards")
  unlink(input)
  unlink(output)
}