split_from | R Documentation |
If the toolkit Pdftk is available in the system, it will be called to Split a single input PDF document into two parts from a given point
See the reference for detailed usage of pdftk
.
split_from(
pg_num,
input_filepath = NULL,
output_directory = NULL,
prefix = "part",
overwrite = TRUE
)
pg_num |
A vector of non-negative integers. Split the pdf document into parts from the numbered pages. |
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 |
overwrite |
If a file exists in |
TRUE if the operation was succesfful. FALSE if the operation fails.
Priyanga Dilini Talagala and Ogan Mancarci
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
if (requireNamespace("lattice", quietly = TRUE)) {
dir <- tempfile()
dir.create(dir)
for(i in 1:4) {
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'))
input_path <- file.path(dir, "Full_pdf.pdf")
split_from(pg_num=2, input_filepath = input_path ,output_directory = dir )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.