| cat_pages {xmpdf} | R Documentation | 
Concatenate pdf documents together
Description
cat_pages() concatenates pdf documents together.
Usage
cat_pages(input, output)
cat_pages_gs(input, output)
cat_pages_pdftk(input, output)
cat_pages_qpdf(input, output)
Arguments
| input | Filename(s) (pdf) to concatenate together | 
| output | Filename (pdf) to save concatenated output to | 
Details
cat_pages() will try to use the following helper functions in the following order:
-  cat_pages_qpdf()which wrapsqpdf::pdf_combine()
-  cat_pages_pdftk()which wrapspdftkcommand-line tool
-  cat_pages_gs()which wrapsghostscriptcommand-line tool
Value
The (output) filename invisibly.
See Also
supports_cat_pages(), supports_gs(), and supports_pdftk() to detect support for these features.
cat_bookmarks() for generating bookmarks for concatenated files.
Examples
if (supports_cat_pages() && require("grid", quietly = TRUE)) {
  # Create two different two-page pdf files
  make_pdf <- function(f, title) {
    pdf(f, onefile = TRUE, title = title)
    grid.text(paste(title, "Page 1"))
    grid.newpage()
    grid.text(paste(title, "Page 2"))
    invisible(dev.off())
  }
  f1 <- tempfile(fileext = "_doc1.pdf")
  on.exit(unlink(f1))
  make_pdf(f1, "Document 1")
  f2 <- tempfile(fileext = "_doc2.pdf")
  on.exit(unlink(f2))
  make_pdf(f2, "Document 2")
  fc <- tempfile(fileext = "_cat.pdf")
  on.exit(unlink(fc))
  cat_pages(c(f1, f2), fc)
  # Use `cat_bookmarks()` to create pdf bookmarks for concatenated output files
  if (supports_get_bookmarks() && supports_set_bookmarks()) {
     l <- get_bookmarks(c(f1, f2))
     bm <- cat_bookmarks(l, "title")
     set_bookmarks(bm, fc)
     print(get_bookmarks(fc)[[1]])
  }
  unlink(f1)
  unlink(f2)
  unlink(fc)
}
[Package xmpdf version 0.2.1 Index]