@benwiggy In this case, your script could become:
import os from pathlib import Path import dialogs from PyPDF2 import PdfFileWriter, PdfFileReader home = "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/" def rotate(filename): shortName = Path(filename).stem outFilename = home + shortName + "+90.pdf" pdfDoc = PdfFileReader(filename) if pdfDoc: output = PdfFileWriter() pages = pdfDoc.getNumPages() for p in range(0, pages): page = pdfDoc.getPage(p) page_out = page.rotateClockwise(90) output.addPage(page_out) outfil = open(outFilename, 'wb') output.write(outfil) outfil.close() print (outFilename) if __name__ == '__main__': filename = dialogs.pick_document(types=['public.data']) rotate(filename)Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.