From eb6f26ae1593dd9b84f27b211ad08abac6231dce Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 28 Jul 2010 19:37:19 -0600 Subject: [PATCH] PDF Output: Don't insert blank pages before every individual HTML file in the ebook. Fixes #6315 (Empty first page in PDF output) --- src/calibre/ebooks/pdf/output.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/calibre/ebooks/pdf/output.py b/src/calibre/ebooks/pdf/output.py index 2a19b09dd9..ca4aab53b3 100644 --- a/src/calibre/ebooks/pdf/output.py +++ b/src/calibre/ebooks/pdf/output.py @@ -59,6 +59,21 @@ class PDFOutput(OutputFormatPlugin): self.metadata = oeb_book.metadata self.cover_data = None + # Remove page-break-before on element as it causes + # blank pages in PDF Output + from calibre.ebooks.oeb.base import OEB_STYLES + stylesheet = None + for item in self.oeb.manifest: + if item.media_type.lower() in OEB_STYLES: + stylesheet = item + break + if stylesheet is not None: + from cssutils.css import CSSRule + for rule in stylesheet.data.cssRules.rulesOfType(CSSRule.STYLE_RULE): + if rule.selectorList.selectorText == '.calibre': + rule.style.removeProperty('page-break-before') + + if input_plugin.is_image_collection: log.debug('Converting input as an image collection...') self.convert_images(input_plugin.get_images())