Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion getannotations
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ highlights, and highlights with text notes are supported.

import os
import sys
import pyPdf
import PyPDF2
from prsannots.prst1 import Reader
from prsannots.misc import u_raw_input, u_print, u_argv

Expand Down
6 changes: 3 additions & 3 deletions prsannots/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from xml.dom import minidom
from StringIO import StringIO
import hashlib
import pyPdf
import PyPDF2
from pagetext import PageText, get_layouts, NoSubstringError, MultipleSubstringError
from pdfannotation import highlight_annotation, text_annotation, add_annotation
from pdfcontent import pdf_add_content, svg_to_pdf_content
Expand Down Expand Up @@ -92,7 +92,7 @@ def hash(self):
@property
def pdf(self):
"""A pyPdf.PdfFileReader instance of the PDF file."""
return pyPdf.PdfFileReader(open(os.path.join(self.reader.path, self.file), 'rb'))
return PyPDF2.PdfFileReader(open(os.path.join(self.reader.path, self.file), 'rb'),strict=False)

def pdf_layout(self, page):
"""Get a pdfminer.LTPage object for page."""
Expand Down Expand Up @@ -125,7 +125,7 @@ def write_annotated_pdf(self, outfd, pdf=None, dice_map=None, **kw):
if dice_map is None:
dice_map = OneToOneMap(len(self.pdf.pages))

outpdf = pyPdf.PdfFileWriter()
outpdf = PyPDF2.PdfFileWriter()
j = k = 0
for i, page in enumerate(pdf.pages):
while j < len(dice_map) and dice_map[j][0] == i:
Expand Down
1 change: 0 additions & 1 deletion prsannots/pagetext.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def get_layouts(fd):

parser = PDFParser(fd)
doc = new_doc(parser)
doc.initialize()

laparams = LAParams()
rsrcmgr = PDFResourceManager()
Expand Down
2 changes: 1 addition & 1 deletion prsannots/pdfannotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# the LGPL license. See the file COPYING for full details.

from datetime import datetime
from pyPdf.generic import *
from PyPDF2.generic import *

YELLOW = [0.95, 0.9, 0.2]

Expand Down
4 changes: 2 additions & 2 deletions prsannots/pdfcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This file is part of prsannots and is distributed under the terms of
# the LGPL license. See the file COPYING for full details.

from pyPdf.pdf import ContentStream
from pyPdf.generic import ArrayObject, NameObject
from PyPDF2.pdf import ContentStream
from PyPDF2.generic import ArrayObject, NameObject

class StupidSVGInterpreterError(Exception):
pass
Expand Down