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_cfgobject- output_filename
Filename for print-and-play file
- size
PnP output size (currently supports either "letter", "A4", or "A5"). This is the targeted “trim” size of the print-and-play file (
size_bleedcan be used to make the print-and-play file larger than this). "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
NULLand combination ofsize/bleedvalues supports "matchsticks" and "pyramids" then defaults toc("piecepack", "pyramids", "matchsticks")else just "piecepack".- arrangement
Either "single-sided" or "double-sided".
- dev
Graphics device function to use if
open_deviceisFALSE. IfNULLinfer a reasonable choice fromfile.- dev.args
Additional arguments to pass to
dev(besidesfilename,width, andheight). Will filter out any names that aren't informals(dev).- quietly
Whether to hide messages about missing metadata in the provided configuration.
- ...
Currently ignored.
- bleed
If
TRUEproduce a variant print-and-play file with "bleed" zones and "crop marks" around game pieces. Currently only supportspieces = "piecepack".- size_bleed
A list with names "top", "right", "bottom", "left" containing numeric values indicating the inches "bleed" to add to the
sizeof the print-and-play layout. The defaultNULLmeans no such bleed added to "letter", "A4", and "A5" layouts. NB. multiply millimeters by0.0393700787to convert to inches. We currently don't support an asymmetric left/right bleed combined witharrangement = "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")
}