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 tempfile(fileext = ".pdf").

...

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()).

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 (pnpmisc:::donttest() &&
    requireNamespace("piecepackr", quietly = TRUE) &&
    utils::packageVersion("piecepackr") >= "1.14.0-5") {
  input <- pdf_create_blank(length = 2L, width = 11, height = 8.5)
  output <- pdf_add_crosshairs(input, pages = "odd",
                               layout = "button_shy_cards")
  unlink(input)
  unlink(output)
}
#> The original pdf contents were rasterized.
#> ℹ `any(pages != "all")` but `qpdf::pdf_overlay_stamp()` does not support a `pages` argument as of v1.4.1.
#> ℹ Suppress this message with `suppressMessages(expr, classes = "pnpmisc_message_rasterized")`.