
PDF Combiner ({pdfcombiner}) is an R package that bundles a simple Shiny App for merging of pdf and/or image files with page selection, removal, or rotation options. The online demo version is available here.
It is a fast, free, and secure alternative to commercial software such as Adobe Acrobat and/or various online websites which require users to sign-up, and it avoids any potential risks associated with uploading files elsewhere.
Features include: - Supports multiple upload of PDFs or image files, either one at a time or all at once - Select PDFs to be combined and change the order of files - Select / remove pages by either using commas (1,2,3), hyphens (5-10), or a combination of both (1,2,3,5-10) - Rotate pages - Watermark stamp with custom text - Built-in PDF viewer / editor to verify changes - Remove password-protection - Smart lossless PDF compression (i.e. always return the smallest file regardless of compression) - Experimental feature of PDF conversion into Word, Excel, PowerPoint, or .png images
PDF Combiner aims to fill a niche where R users with restricted permissions (i.e. corporate environment) could still have a local option to handle most of their PDF needs for free.
You can install the latest development version from GitHub:
## Install devtools first if required
# install.packages(devtools)
devtools::install_github("stevechoy/pdfcombiner")
## Pending CRAN submission
# install.packages(pdfcombiner)
For advanced users, you may run PDF Combiner locally without installing it as a package (i.e. launch the App directly from R console), as long as you have the following packages:
install.packages(shiny)
install.packages(pdftools)
# install.packages(staplr) # Recommended, retains bookmarks (may need separate Java installation)
# install.packages(magick) # Recommended, allows image files to be uploaded
# install.packages(officer) # Optional, only used for PDF conversion to Word / Powerpoint
# install.packages(openxlsx) # Optional, only used for PDF conversion to Excel
shiny::runGitHub("stevechoy/pdfcombiner", subdir = "inst/shiny", launch.browser = TRUE)
## Or you can copy directly from https://github.com/stevechoy/pdfcombiner/blob/main/inst/shiny/app.R
The {staplr} package is highly recommended as it supports bookmarks, however it uses Java so you may need to install Java separately if your system does not currently have it (instructions are included on the {staplr} page). Tip: Choose the 64-bit version if your R installation is also 64-bit.
After installation, you are recommended to restart your R instance before proceeding.
library(pdfcombiner)
pdfcombiner()
## see ?pdfcombiner() for a list of options
# pdfcombiner(bootstrap_theme = FALSE) # Turning off bootstrap theme for older versions of shiny
Instructions are included on the left hand side of the page.

{bslib} package), which allows minimizing of the sidebar. You can turn off this option by setting bootstrap_theme = FALSE during App launch. {staplr} package. Importantly, bookmarks cannot be retained when any pages are selected, removed, or rotated (or when passwords are removed). {staplr} package. watermark_stamp(), e.g. pdfcombiner:::watermark_stamp(input_pdf = "path/to/input.pdf", output_pdf = "path/to/output.pdf", watermark_text = "Some Text"). compact_level argument for pdfcombiner(), e.g. pdfcombiner(compact_level = "screen"). The default argument ("ebook") will re-save all raster images as 150dpi, which is a good middle ground without compromising too much quality. This feature requires prior Ghostscript installation. tempdir() function. {staplr} package. Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.