Learn R Programming

staplr (version 3.2.2)

combine_pdf: Combine multiple PDF files

Description

Combine multiple PDF files by delimiting the sequences of pages in each file.

Usage

combine_pdf(vec_input, output = "output.pdf", start_pages = NA, end_pages = NA)

Value

In the path informed in output, the PDF file resulting from the combination of multiple files passed to vec_output will be saved.

Arguments

vec_input

Vector with paths of PDF files to be combined.

output

PDF file path result of the combination.

start_pages

Vector with the initial pages of each file. If NA, the default, will be considered the first page.

end_pages

Vector with the final pages of each file. If NA, the default, will be considered the last page.

Examples

Run this code


if (requireNamespace("lattice", quietly = TRUE)) {
dir <- tempfile()
dir.create(dir)
for(i in 1:2) {
pdf(file.path(dir, paste("plot", i, ".pdf", sep = "")))
print(lattice::xyplot(iris[,1] ~ iris[,i], data = iris))
dev.off()
}

output <- tempfile(fileext = '.pdf')
combine_pdf(
   vec_input =
      file.path(dir, paste("plot", 1:2, ".pdf", sep = "")),
   output = output,
   start_pages = c(NA, NA),
   end_pages = c(NA, NA)
 )
 }

Run the code above in your browser using DataLab