The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Load the cpp11qpdf package and set the path to an example PDF file included with R for demonstration purposes.
library(cpp11qpdf)
input_pdf <- system.file("examples", "sufganiyot.pdf", package = "cpp11qpdf")To compress a PDF file, use the pdf_compress function. This function takes an input PDF file and an output file path.
output_pdf <- tempfile(fileext = ".pdf")
pdf_compress(input_pdf, output_pdf, password = "")
#> [1] "/tmp/RtmpsCdya7/file61ac6d0311b3.pdf"
file.exists(output_pdf)
#> [1] TRUETo rotate pages in a PDF, use the pdf_rotate_pages function. This function takes an input PDF file, the pages to rotate, the angle of rotation, and the output file path.
output_pdf <- tempfile(fileext = ".pdf")
pdf_rotate_pages(input_pdf, pages = 1, angle = 90, output = output_pdf,
password = "")
#> [1] "/tmp/RtmpsCdya7/file61ac670db2c0.pdf"
file.exists(output_pdf)
#> [1] TRUETo split a PDF into individual pages, use the pdf_split function. This function takes an input PDF file and an output file prefix.
output_prefix <- tempfile()
output_files <- pdf_split(input_pdf, output_prefix, password = "")
output_files
#> [1] "/tmp/RtmpsCdya7/file61ac626e198a_1.pdf"
#> [2] "/tmp/RtmpsCdya7/file61ac626e198a_2.pdf"To combine multiple PDF files into a single PDF, use the pdf_combine function. This function takes a vector of input PDF files and an output file path.
# using the output files from the previous example
output_pdf <- tempfile(fileext = ".pdf")
pdf_combine(output_files, output_pdf, password = "")
#> [1] "/tmp/RtmpsCdya7/file61ace69db3d.pdf"
file.exists(output_pdf)
#> [1] TRUETo extract specific pages from a PDF, use the pdf_subset function. This function takes an input PDF file, the pages to extract, and the output file path.
output_pdf <- tempfile(fileext = ".pdf")
pdf_subset(input_pdf, 1, output_pdf, password = "")
#> [1] "/tmp/RtmpsCdya7/file61ac3f3b3af6.pdf"
file.exists(output_pdf)
#> [1] TRUETo overlay a stamp on each page of a PDF, use the pdf_overlay_stamp function. This function takes an input PDF file, a stamp PDF file, and the output file path.
stamp_pdf <- system.file("examples", "header.pdf", package = "cpp11qpdf")
output_pdf <- tempfile(fileext = ".pdf")
pdf_overlay_stamp(input_pdf, stamp_pdf, output_pdf, password = "")
#> [1] "/tmp/RtmpsCdya7/file61ac27407e7e.pdf"
file.exists(output_pdf)
#> [1] TRUENow the pages have a header that is not a part of the original PDF.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.