mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 20:39:59 +00:00
PdfFileReader -> PdfReader
This commit is contained in:
parent
ce0b3d8d10
commit
364c48edd8
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user