From d68eb98518dbd24828fafff03596b83bea1e7ef2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 May 2017 11:36:40 +0530 Subject: [PATCH] DOCX Output: Fix lengths specified in percentage of page size not being converted correctly. See #1688690 (links do not work when converted azw3 to docx; pictures too big) --- src/calibre/ebooks/docx/writer/from_html.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/writer/from_html.py b/src/calibre/ebooks/docx/writer/from_html.py index be7cbb7db0..b58b011c19 100644 --- a/src/calibre/ebooks/docx/writer/from_html.py +++ b/src/calibre/ebooks/docx/writer/from_html.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import re from collections import Counter -from calibre.ebooks.docx.writer.container import create_skeleton, page_size +from calibre.ebooks.docx.writer.container import create_skeleton, page_size, page_effective_area from calibre.ebooks.docx.writer.styles import StylesManager, FloatSpec from calibre.ebooks.docx.writer.links import LinksManager from calibre.ebooks.docx.writer.images import ImagesManager @@ -413,6 +413,8 @@ class Convert(object): self.log, self.opts = docx.log, docx.opts self.mi = mi self.cover_img = None + p = self.opts.output_profile + p.width_pts, p.height_pts = page_effective_area(self.opts) def __call__(self): from calibre.ebooks.oeb.transforms.rasterize import SVGRasterizer @@ -464,7 +466,7 @@ class Convert(object): self.current_item = item stylizer = self.svg_rasterizer.stylizer_cache.get(item) if stylizer is None: - stylizer = Stylizer(item.data, item.href, self.oeb, self.opts, self.opts.output_profile, base_css=self.base_css) + stylizer = Stylizer(item.data, item.href, self.oeb, self.opts, profile=self.opts.output_profile, base_css=self.base_css) self.abshref = self.images_manager.abshref = item.abshref self.current_lang = lang_for_tag(item.data) or self.styles_manager.document_lang