combine_pdf: Combine multiple PDF files

View source: R/combine_pdf.R

combine_pdfR Documentation

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)

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.

Value

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

Examples



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)
 )
 }

staplr documentation built on Sept. 18, 2023, 5:16 p.m.

Related to combine_pdf in staplr...