save_print_and_play: Save piecepack print-and-play (PnP) file

View source: R/save_print_and_play.R

save_print_and_playR Documentation

Save piecepack print-and-play (PnP) file

Description

Save piecepack print-and-play (PnP) file

Usage

save_print_and_play(
  cfg = getOption("piecepackr.cfg", pp_cfg()),
  output_filename = "piecepack.pdf",
  size = c("letter", "A4", "A5", "4x6"),
  pieces = NULL,
  arrangement = c("single-sided", "double-sided"),
  dev = NULL,
  dev.args = list(family = cfg$fontfamily, onefile = TRUE, units = "in", bg = "white",
    res = 300),
  quietly = FALSE,
  ...,
  bleed = FALSE,
  size_bleed = NULL
)

Arguments

cfg

Piecepack configuration list or pp_cfg object

output_filename

Filename for print-and-play file

size

PnP output size (currently supports either "letter", "A4", "A5", or "4x6"). This is the targeted “trim” size of the print-and-play file (size_bleed can be used to make the print-and-play file larger than this). Size "4x6" currently only supports pieces = "piecepack" and doesn't support bleed = TRUE. "A5" is in “portrait” mode whereas the other sizes are in “landscape” mode.

pieces

Character vector of desired PnP pieces. Supports "piecepack", "matchsticks", "pyramids", "subpack", or "all". If NULL and combination of size / bleed values supports "matchsticks" and "pyramids" then defaults to c("piecepack", "pyramids", "matchsticks") else just "piecepack".

arrangement

Either "single-sided" or "double-sided". Ignored if size = "4x6".

dev

Graphics device function to use. If NULL infer a reasonable choice.

dev.args

Additional arguments to pass to dev (besides filename, width, and height). Will filter out any names that aren't in formals(dev).

quietly

Whether to hide messages about missing metadata in the provided configuration.

...

Currently ignored.

bleed

If TRUE produce a variant print-and-play file with "bleed" zones and "crop marks" around game pieces. Currently only supports pieces = "piecepack" and doesn't support size = "4x6".

size_bleed

A list with names "top", "right", "bottom", "left" containing numeric values indicating the inches "bleed" to add to the size of the print-and-play layout. The default NULL means no such bleed added to "letter", "A4", "A5" layouts and a small bleed added to "4x6" layouts (1/16" to top/bottom and 3/32" to left/right). NB. multiply millimeters by 0.0393700787 to convert to inches. We currently don't support an asymmetric left/right bleed combined with arrangement = "double-sided".

Examples

# May take more than 5 seconds on CRAN servers
if (capabilities("cairo")) {
  cfg <- pp_cfg(list(invert_colors.suited=TRUE))
  cfg$description <- 'Piecepack with an "inverted" color scheme.'
  cfg$title <- '"Inverted" piecepack'
  cfg$copyright <- "\u00a9 2022 Trevor L Davis.  Some Right Reserved."
  cfg$spdx_id <- "CC-BY-4.0"
  cfg$credit <- ""

  file <- tempfile("my_pnp_file", fileext = ".pdf")
  file_ds <- tempfile("my_pnp_file_ds", fileext = ".pdf")
  file_a4 <- tempfile("my_pnp_file_a4", fileext = ".pdf")
  file_a5 <- tempfile("my_pnp_file_a5", fileext = ".pdf")

  save_print_and_play(cfg, file)
  save_print_and_play(cfg, file_ds, arrangement="double-sided")
  save_print_and_play(cfg, file_a4, size="A4", pieces="all")
  save_print_and_play(cfg, file_a5, size="A5")
}


piecepackr documentation built on Sept. 11, 2024, 9:09 p.m.