Yesterday I got a review copy of. It explains, among other things, how to manipulate PDFs from Python. This morning I needed to rotate some pages in a PDF, so I decided to try out the method in the book.The sample code uses PyPDF2. I’m using Conda for my Python environment, and PyPDF2 isn’t directly available for Conda. I searched Binstar withbinstar search -t conda pypdf2The first hit was from JimInCO, so I installed PyPDF2 withconda install -c pypdf2I scanned a few pages from a book to PDF, turning the book around every other page, so half the pages in the PDF were upside down. I needed a script to rotate the even numbered pages.
PyPDF2’s counterpart to PdfFileReader objects is PdfFileWriter objects, which can create new PDF files. But PyPDF2 cannot write arbitrary text to a PDF like Python can do with plaintext files. Instead, PyPDF2’s PDF-writing capabilities are limited to copying pages from other PDFs, rotating pages, overlaying pages, and encrypting files. With the PyPDF2 package, you can also crop pages, add Javascript code, encrypt, rotate, scale, and transform pages. The documentation covers these uses and the sample code that comes with the package shows you how to do each operation.
![Pypdf2 rename pages page Pypdf2 rename pages page](https://d2d42mpnbqmzj3.cloudfront.net/images/stories/doc-excel/rename-multiple-files-in-folder/xdoc-rename-multiple-files-5.png.pagespeed.ic.83WxHsam0F.png)
![Pypdf2 rename pages online Pypdf2 rename pages online](/uploads/1/2/5/4/125424083/352489551.png)
The script counts pages from 0, so it rotates the odd numbered pages from its perspective.import PyPDF2pdfin = open('original.pdf', 'rb')pdfreader = PyPDF2.PdfFileReader(pdfin)pdfwriter = PyPDF2.PdfFileWriterfor pagenum in range(pdfreader.numPages):page = pdfreader.getPage(pagenum)if pagenum% 2:page.rotateClockwise(180)pdfwriter.addPage(page)pdfout = open('rotated.pdf', 'wb')pdfwriter.write(pdfout)pdfout.closepdfin.closeIt worked as advertised on the first try. Hi,Are you missing an else statement?Your code only prints the odd / rotated pages.This worked for me:import PyPDF2pdfin = open(‘original.pdf’, ‘rb’)pdfreader = PyPDF2.PdfFileReader(pdfin)pdfwriter = PyPDF2.PdfFileWriterfor pagenum in range(pdfreader.numPages):page = pdfreader.getPage(pagenum)if pagenum% 2:page.rotateClockwise(180)pdfwriter.addPage(page)else:pdfwriter.addPage(page)pdfout = open(‘rotated.pdf’, ‘wb’)pdfwriter.write(pdfout)pdfout.closepdfin.close.
OneNote for iOSYou can rename any of the pages, sections, or section groups in your notebook — or you can rename the entire notebook itself. Caution: Before renaming notebooks that you have already shared with other people, consider giving the other notebook authors some amount of advance notice about your plans to rename the notebook they’re working in. This way, the change does not unexpectedly prevent them from accessing important information in the shared notebook.When you’re ready to rename a notebook, do the following:.First, you need to close the notebook. In OneNote, tap the Show Notebooks buttonto open to the notebook list.Tap and hold the notebook you want to rename. At the bottom of the notebook list, tap the Close Notebookicon, and then choose Close.Go to OneDrive to complete the renaming of the notebook. In Safari or in any other Web browser, go to.If necessary, sign in with the same Microsoft account or organizational account where the notebook you want to rename is currently stored.When you are successfully signed into OneDrive, navigate to the Documents folder for your account. Note: You might need to navigate to a different folder if the notebook was initially saved to a folder other than Documents.Tap and hold the notebook you want to rename.You'll see a small check mark next to the notebook.
If the check mark doesn't appear, you may need to need to tap and hold a little longer.On the OneDrive menu bar, tap the three dots icon located in the upper right, and then choose Rename This File.Type the new name for the notebook, and then tap Done.On the same page, tap the notebook icon to open the renamed notebook in OneNote.See Also.