From 56b81a89dc313135a61e80231ff71f22f79e187f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 May 2017 08:56:36 +0530 Subject: [PATCH] Fix #1688547 [Converting PDF to EPUB: incorrect IDs](https://bugs.launchpad.net/calibre/+bug/1688547) --- src/calibre/ebooks/pdf/pdftohtml.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/pdf/pdftohtml.py b/src/calibre/ebooks/pdf/pdftohtml.py index ff2112e620..ec1ae9366e 100644 --- a/src/calibre/ebooks/pdf/pdftohtml.py +++ b/src/calibre/ebooks/pdf/pdftohtml.py @@ -97,7 +97,7 @@ def pdftohtml(output_dir, pdf_path, no_images, as_xml=False): raise DRMError() if not as_xml: - with open(index, 'r+b') as i: + with lopen(index, 'r+b') as i: raw = i.read() raw = flip_images(raw) raw = '\n' + raw @@ -107,6 +107,9 @@ def pdftohtml(output_dir, pdf_path, no_images, as_xml=False): # breaks the pdf heuristics regexps, so replace them raw = raw.replace(b'
', b'
') raw = re.sub(br' 2: