mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
A more helpful error message when trying to convert a DRMed PDF file.
This commit is contained in:
parent
6f7a0c8bb7
commit
4f043f3323
@ -23,7 +23,7 @@ from libprs500.ebooks.lrf.html.convert_from import process_file as html_process_
|
|||||||
|
|
||||||
PDFTOHTML = 'pdftohtml'
|
PDFTOHTML = 'pdftohtml'
|
||||||
if isosx and hasattr(sys, 'frameworks_dir'):
|
if isosx and hasattr(sys, 'frameworks_dir'):
|
||||||
PDFTOHTML = os.path.join(sys.frameworks_dir, PDFTOHTML)
|
PDFTOHTML = os.path.join(getattr(sys, 'frameworks_dir'), PDFTOHTML)
|
||||||
|
|
||||||
|
|
||||||
def generate_html(pathtopdf, logger):
|
def generate_html(pathtopdf, logger):
|
||||||
@ -47,6 +47,8 @@ def generate_html(pathtopdf, logger):
|
|||||||
if ret != 0:
|
if ret != 0:
|
||||||
err = p.stderr.read()
|
err = p.stderr.read()
|
||||||
raise ConversionError, err
|
raise ConversionError, err
|
||||||
|
if os.stat(pf.name).st_size < 100:
|
||||||
|
raise ConversionError(os.path.basename(pathtopdf) + ' does not allow copying of text.')
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
return pf
|
return pf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user