I tried giving the staplr package a go and I did install the required toolkit Pdftk but I still don't get the pdf to flip even though I do get prompted to select an input pdf and an output location with file save. I am assuming I don't have the ability given this is a premium feature in the toolkit.
Is there another R way to rotate the pages in a pdf?
import PyPDF2
original = open('R-intro.pdf', 'rb')
pdf_in = PyPDF2.PdfFileReader(original)
rotated = open('R-intro-upside-down.pdf', 'wb')
pdf_out = PyPDF2.PdfFileWriter()
for pg in range(pdf_in.numPages):
page = pdf_in.getPage(pg)
page.rotateClockwise(180)
pdf_out.addPage(page)
pdf_out.write(rotated)
rotated.close()
original.close()
Depending on your use case, you could run these lines manually, convert it to a command-line Python script, or integrate it into an R script via reticulate.