From bcd8bcdcb56529e05fd801119bf7a071b9876e86 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Jan 2015 09:42:16 +0530 Subject: [PATCH] PDF Output: Make the minimum height for headers and footers scale with the base font size --- src/calibre/ebooks/conversion/plumber.py | 1 + src/calibre/ebooks/pdf/render/from_html.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 5c217a227a..0094512384 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -1153,6 +1153,7 @@ OptionRecommendation(name='search_replace', specializer=partial(self.output_plugin.specialize_css_for_output, self.log, self.opts)) flattener(self.oeb, self.opts) + self.opts._final_base_font_size = fbase self.opts.insert_blank_line = oibl self.opts.remove_paragraph_spacing = orps diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index ba6d605c27..60183e3718 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -192,12 +192,12 @@ class PDFWriter(QObject): self.header = opts.pdf_header_template if self.header: self.header = self.header.strip() - min_margin = 36 + min_margin = 1.5 * opts._final_base_font_size if self.footer and opts.margin_bottom < min_margin: - self.log.warn('Bottom margin is too small for footer, increasing it.') + self.log.warn('Bottom margin is too small for footer, increasing it to %.1fpts' % min_margin) opts.margin_bottom = min_margin if self.header and opts.margin_top < min_margin: - self.log.warn('Top margin is too small for header, increasing it.') + self.log.warn('Top margin is too small for header, increasing it to %.1fpts' % min_margin) opts.margin_top = min_margin self.page.setViewportSize(QSize(self.doc.width(), self.doc.height()))