diff --git a/src/calibre/ebooks/conversion/plugins/djvu_input.py b/src/calibre/ebooks/conversion/plugins/djvu_input.py index 8f25551af8..ed61ff04d3 100644 --- a/src/calibre/ebooks/conversion/plugins/djvu_input.py +++ b/src/calibre/ebooks/conversion/plugins/djvu_input.py @@ -28,8 +28,12 @@ class DJVUInput(InputFormatPlugin): from calibre.ebooks.djvu.djvu import DJVUFile x = DJVUFile(stream) x.get_text(stdout) + raw_text = stdout.getvalue() + if not raw_text: + raise ValueError('The DJVU file contains no text, only images, probably page scans.' + ' calibre only supports conversion of DJVU files with actual text in them.') - html = convert_basic(stdout.getvalue().replace(b"\n", b' ').replace( + html = convert_basic(raw_text.replace(b"\n", b' ').replace( b'\037', b'\n\n')) # Run the HTMLized text through the html processing plugin. from calibre.customize.ui import plugin_for_input_format