mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-21 04:13:39 +02:00
Try to detect image based PDFs and give a more intelligent error message for them
This commit is contained in:
parent
8793c335ac
commit
82a5116f38
1 changed files with 4 additions and 1 deletions
|
|
@ -41,7 +41,10 @@ def generate_html(pathtopdf, logger):
|
|||
err = p.stderr.read()
|
||||
raise ConversionError, err
|
||||
if not os.path.exists(index) or os.stat(index).st_size < 100:
|
||||
raise ConversionError(os.path.basename(pathtopdf) + ' does not allow copying of text.')
|
||||
raise ConversionError(os.path.basename(pathtopdf) + _(' does not allow copying of text.'))
|
||||
raw = open(index).read(4000)
|
||||
if not '<br' in raw:
|
||||
raise ConversionError(os.path.basename(pathtopdf) + _(' is an image based PDF. Only conversion of text based PDFs is supported.'))
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
return index
|
||||
|
|
|
|||
Loading…
Reference in a new issue