From 044d21b8bc0ce7425117d9d7c5f6d1b97eadcb45 Mon Sep 17 00:00:00 2001 From: Nemo Date: Fri, 28 May 2021 21:38:53 +0530 Subject: [PATCH] Switch to PyPDF3 --- README.rst | 18 ++++++++++++++---- setup.cfg | 2 +- src/pystitcher/stitcher.py | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 9b745c2..47711b7 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,7 @@ pystitcher ========== - -pystitcher stitches your PDF files together, generating nice customizable bookmarks for you using a declarative input file. +pystitcher stitches your PDF files together, generating nice customizable bookmarks for you using a declarative input in the form of a markdown file. It is written in pure python and uses `PyPDF3 `_ for reading and writing PDF files. Description @@ -12,6 +11,10 @@ Description Given this input:: existing_bookmarks: flatten + title: Complete Guide to the Personal Data Protection Bill + author: Medianama + keywords: privacy, surveillance, personal data protection + subject: Personal Data Protection Bill # A Complete Guide to the Personal Data Protection Bill - [Cover](cover.pdf) @@ -35,10 +38,17 @@ Will generate a PDF with proper bookmarks: .. image:: https://i.imgur.com/qPVpZGt.png +And the correct metadata:: + + Title: Complete Guide to the Personal Data Protection Bill + Subject: Personal Data Protection Bill + Keywords: privacy, surveillance, personal data protection + Author: Medianama + Creator: pystitcher/0.0.1 + Producer: pystitcher/0.0.1 + Configuration options can be specified with Meta data at the top of the file. These include: - - .. _pyscaffold-notes: Note diff --git a/setup.cfg b/setup.cfg index ff06662..1cc8775 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ python_requires = >=3.6 install_requires = importlib-metadata; python_version<"3.8" # Read and write bookmarks from PDF - PyPDF2>=1.26.0 + PyPDF3>=1.0.4 # Read the input file and convert it to HTML Markdown>=3.3.4 # Parse the HTML to generate bookmarks diff --git a/src/pystitcher/stitcher.py b/src/pystitcher/stitcher.py index e067515..d1d6c2e 100644 --- a/src/pystitcher/stitcher.py +++ b/src/pystitcher/stitcher.py @@ -2,7 +2,7 @@ import os import markdown from .bookmark import Bookmark import html5lib -from PyPDF2 import PdfFileWriter, PdfFileReader +from PyPDF3 import PdfFileWriter, PdfFileReader from pystitcher import __version__ import tempfile import logging