From d0106bd4a0764b59980ee90b7dc92c035c68666b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Jun 2008 11:41:44 -0700 Subject: [PATCH] IGN:Fix rendering of tables to images to not always create full page images --- src/calibre/ebooks/lrf/html/table_as_image.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/lrf/html/table_as_image.py b/src/calibre/ebooks/lrf/html/table_as_image.py index 4c5a79eab8..f4bdfa973d 100644 --- a/src/calibre/ebooks/lrf/html/table_as_image.py +++ b/src/calibre/ebooks/lrf/html/table_as_image.py @@ -46,9 +46,11 @@ class HTMLTableRenderer(QObject): painter = QPainter(image) self.page.mainFrame().render(painter) painter.end() + cheight = image.height() + cwidth = image.width() pos = 0 while pos < cheight: - img = image.copy(0, pos, cwidth, cutoff_height) + img = image.copy(0, pos, cwidth, min(cheight-pos, cutoff_height)) pos += cutoff_height-20 if cwidth > self.width: img = img.scaledToWidth(self.width, Qt.SmoothTransform) @@ -70,7 +72,7 @@ def render_table(server, soup, table, css, base_dir, width, height, dpi, factor= %s - +