Skip to contents

pdf_rep() repeats pages of a pdf similar to base::rep().

Usage

pdf_rep(
  input,
  output = NULL,
  ...,
  pages = "all",
  times = 1L,
  length.out = NA_integer_,
  each = 1L
)

Arguments

input

Input pdf filename.

output

Output pdf filename. NULL defaults to tempfile(fileext = ".pdf").

...

Ignored.

pages

A positive numeric vector of pages to include, a negative numeric vector of pages to exclude, or a string:

all

Include all the pages.

even

Include just the even pages.

odd

Include just the odd pages.

The functions pdf_pages() and pdf_subset() also support the string:

2-up saddle stitch

The order of the pages to create a saddle-stitch booklet if printing 2-up.

interleave

Interleave the first and second halves of the pages. Requires an even number of pages.

interleave_first

Repeat the first page n - 1 times and interleave with the remaining n - 1 pages.

interleave_last

Repeat the last page n - 1 times and interleave with the first n - 1 pages.

times, length.out, each

Passed to base::rep().

Value

output pdf file name invisibly. As a side effect creates a pdf with repeated pages.

See also

Examples

f1 <- pdf_create_blank(length = 3L, paper = "letter")
f2 <- pdf_rep(f1, times = 2L)
f3 <- pdf_rep(f1, pages = 1:2, each = 2L)
unlink(f1)
unlink(f2)
unlink(f3)