The function below was provided by @Tyler Rinker and can be found here.
Function I am struggling with:
mergePDF <- function(..., file, gsversion = NULL, in.file = NULL) { if (is.null(in.file)) { in.file <- substitute(...()) } infiles <- paste(unlist(lapply(file.folder, function(y) as.character(y))), collapse = " ") if (is.null(gsversion)) { gsversion <- names(which(Sys.which(c("gswin64c")) != paste("C:/Program Files/gs9.15/bin/gswin64c.exe",sep=""))) } pre = " -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" system(paste(paste(gsversion, pre, file, sep = ""), infiles, collapse="")) }
I would like to link (merge) several existing PDF files into 1 pdf file. I have several files named according to id , for example: doc_123232.pdf, doc_434324.pdf, etc.
How to install in.file ?
Ideally, I would like to install only the folder in which the files are stored: something like: Sys.glob("C:/Path/doc*.pdf")
EDIT: I tried this now with only 1 page pdf, but not for multiple files:
mergePDF(file="C:/1pagepdf.pdf",in.file="C:/path/doc_123232.pdf")
I get the error: had status 127 ==> I do not understand the in.file parameter
source share