Skip to content

Instantly share code, notes, and snippets.

@apoorv74
Created November 3, 2017 12:41
Show Gist options
  • Save apoorv74/cf085aa356a84c8cd8e6f23c1f82b304 to your computer and use it in GitHub Desktop.
Save apoorv74/cf085aa356a84c8cd8e6f23c1f82b304 to your computer and use it in GitHub Desktop.
Merging PDF's
library(plotflow)
library(reports)
## make a folder to store the pdfs
folder(deleteMe)
## paste the paths to pdfs together in one string w/ spaces
plotflow:::mergePDF(
in.file=paste(file.path("deleteMe", dir("deleteMe")), collapse=" "),
file="merged.pdf"
)
## delete MWE
delete('deleteMe')
@apoorv74
Copy link
Author

apoorv74 commented Nov 6, 2017

To reduce PDF size - use this ghostscript utility gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=mydocsmaller.pdf UNDP\ India\ -\ Technical\ Proposal.pdf

file size or image quality can be manipulated by adjusting the PDFSETTINGS parameter, eg: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dColorImageResolution=200 \-dNOPAUSE -dQUIET -dBATCH -sOutputFile=mydocsmaller.pdf UNDP\ India\ -\ Technical\ Proposal.pdf

SO: https://stackoverflow.com/questions/10450120/optimize-pdf-files-with-ghostscript-or-other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment