split_pdf {staplr}R Documentation

Splits single input PDF document into individual pages.

Description

If the toolkit Pdftk is available in the system, it will be called to Split a single input PDF document into individual pages.

See the reference for detailed usage of pdftk.

Usage

split_pdf(input_filepath = NULL, output_directory = NULL, prefix = "page_")

Arguments

input_filepath

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

output_directory

the path of the output directory

prefix

A string for output filename prefix

Value

TRUE if the operation was succesfful. FALSE if the operation fails.

Author(s)

Priyanga Dilini Talagala and Ogan Mancarci

References

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

Examples


if (requireNamespace("lattice", quietly = TRUE)) {
dir <- tempfile()
dir.create(dir)
for(i in 1:3) {
pdf(file.path(dir, paste("plot", i, ".pdf", sep = "")))
print(lattice::xyplot(iris[,1] ~ iris[,i], data = iris))
dev.off()
}
staple_pdf(input_directory = dir, output_filepath = file.path(dir, 'Full_pdf.pdf'))
split_pdf(input_filepath = file.path(dir, paste("Full_pdf.pdf",  sep = "")),output_directory = dir )
}

[Package staplr version 3.2.2 Index]