I am actively working on bookmark support for pdfrw, but it has none at present. It also has specialized functions for several things such as merging bookmarks from two different PDFs.
#HOW TO INSTALL PYPDF2 LIBRARY PDF#
PyPDF2 supports more PDF features than pdfrw, including decryption and more types of decompression. (I’m not an expert with PyPDF2 by any means, so please let me know in the comments if I have made any egregious errors.) In terms of focus, pdfrw is much closer to PyPDF2 than it is to pdfminer, so the rest of this article discusses pdfrw in relation to PyPDF2. As discussed in Tim’s tutorial, the two most popular pure Python PDF libraries are pdfminer and PyPDF2. It also has no dependencies except Python, and the current version (0.2) is available on PyPI for both Python 2 and Python 3 (2.6, 2.7, 3.3, and 3.4).
What good is it?Īs you may have garnered from either the introduction, or from the name of the library, pdfrw can read and write PDF files. In this tutotial, I’ll provide a primer on pdfrw, complete with an overview of its features and some examples. Since I’ve started cleaning it up, I figured I might as well also put some effort into telling people about it. Now pdfrw is at version 0.2, and I hope not to get so far behind in the future.
During the transition I’ve fixed bugs, incorporated some tests, added support for Python 3, and merged some code that someone contributed for parsing PDF 1.5 stream objects. Since Google Code shut down, I finally moved the project to Github. Tim’s article does a good job of describing pdfminer and PyPDF2, but it doesn’t go into detail with pdfrw, and for good reason. (Or maybe you haven’t actually seen Tim’s tutorial, in which case you should go read it now, because it’s chock full of good advice, and this article builds on it.) Nonetheless, you’ve decided to ignore Tim’s advice, and that’s why you’re here. As Tim Arnold explains in Manipulating PDFs with Python, even beautiful PDFs are often unspeakably ugly inside, and if you can avoid having to manipulate them, you should.