If the toolkit Pdftk is available in the system, it will be called to merge the PDF files.

See the reference for detailed usage of pdftk.

staple_pdf(
  input_directory = NULL,
  input_files = NULL,
  output_filepath = NULL,
  overwrite = TRUE
)

Arguments

input_directory

the path of the input PDF files. The default is set to NULL. If NULL, it prompt the user to select the folder interactively.

input_files

a vector of input PDF files. The default is set to NULL. If NULL and input_directory is also NULL, the user is propted to select a folder interactively.

output_filepath

the path of the output PDF file. The default is set to NULL. IF NULL, it prompt the user to select the folder interactively.

overwrite

If a file exists in output_filepath, should it be overwritten.

Value

this function returns a combined PDF document

References

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

Author

Priyanga Dilini Talagala and Daniel Padfield

Examples

if (FALSE) { staple_pdf() } if (FALSE) { dir <- tempdir() require(lattice) for(i in 1:3) { pdf(file.path(dir, paste("plot", i, ".pdf", sep = ""))) print(xyplot(iris[,1] ~ iris[,i], data = iris)) dev.off() } output_file <- file.path(dir, paste('Full_pdf.pdf', sep = "")) staple_pdf(input_directory = dir, output_filepath = output_file) }