2
0
mirror of https://github.com/janeczku/calibre-web synced 2024-10-31 15:20:28 +00:00

PdfFileReader -> PdfReader

This commit is contained in:
blitzmann 2023-01-16 00:24:44 -05:00
parent ce0b3d8d10
commit 364c48edd8

View File

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