Merge remote-tracking branch 'pdfreader/issue-2659'

This commit is contained in:
Ozzie Isaacs 2023-01-21 14:27:59 +01:00
commit 9e75c65af8
3 changed files with 5 additions and 6 deletions

View File

@ -37,12 +37,12 @@ except (ImportError, RuntimeError) as e:
use_generic_pdf_cover = True
try:
from PyPDF2 import PdfFileReader
from PyPDF2 import PdfReader
use_pdf_meta = True
except ImportError as ex:
log.debug('PyPDF2 is recommended for best performance in metadata extracting from pdf files: %s', ex)
try:
from PyPDF3 import PdfFileReader
from PyPDF3 import PdfFileReader as PdfReader
use_pdf_meta = True
except ImportError as e:
log.debug('Cannot import PyPDF3/PyPDF2, extracting pdf metadata will not work: %s / %s', e)
@ -157,7 +157,7 @@ def pdf_meta(tmp_file_path, original_file_name, original_file_extension):
if use_pdf_meta:
with open(tmp_file_path, 'rb') as f:
pdf_file = PdfFileReader(f)
pdf_file = PdfReader(f)
doc_info = pdf_file.getDocumentInfo()
try:
doc_info = pdf_file.getDocumentInfo()

View File

@ -7,7 +7,7 @@ Flask-Principal>=0.3.2,<0.5.1
backports_abc>=0.4
Flask>=1.0.2,<2.2.0
iso-639>=0.4.5,<0.5.0
PyPDF2>=1.20,<3.1.0
PyPDF2>=1.28,<3.1.0
pytz>=2016.10
requests>=2.11.1,<2.28.0
SQLAlchemy>=1.3.0,<1.5.0

View File

@ -18,7 +18,6 @@ classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: GNU Affero General Public License v3
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
@ -47,7 +46,7 @@ install_requires =
backports_abc>=0.4
Flask>=1.0.2,<2.2.0
iso-639>=0.4.5,<0.5.0
PyPDF2>=1.20,<3.1.0
PyPDF2>=1.28,<3.1.0
pytz>=2016.10
requests>=2.11.1,<2.28.0
SQLAlchemy>=1.3.0,<1.5.0