Skip to contents

pdf_pages() calculates an integer vector of subset of pdf pages.

Usage

pdf_pages(
  input,
  ...,
  pages = c("all", "even", "odd", "2-up saddle stitch", "interleave", "interleave_first",
    "interleave_last")
)

Arguments

input

Input pdf filename.

...

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.

Value

An integer vector.

Examples

f <- pdf_create_blank(length = 8L)
pdf_pages(f, pages = 1:4)
#> [1] 1 2 3 4
pdf_pages(f, pages = -(1:4))
#> [1] 5 6 7 8
pdf_pages(f, pages = "all")
#> [1] 1 2 3 4 5 6 7 8
pdf_pages(f, pages = "even")
#> [1] 2 4 6 8
pdf_pages(f, pages = "odd")
#> [1] 1 3 5 7
pdf_pages(f, pages = "interleave")
#> [1] 1 5 2 6 3 7 4 8
pdf_pages(f, pages = "interleave_first")
#>  [1] 1 2 1 3 1 4 1 5 1 6 1 7 1 8
pdf_pages(f, pages = "interleave_last")
#>  [1] 1 8 2 8 3 8 4 8 5 8 6 8 7 8

unlink(f) # Clean up