IGN:Fix rendering of tables to images to not always create full page images

This commit is contained in:
Kovid Goyal 2008-06-20 11:41:44 -07:00
parent d3075d1636
commit d0106bd4a0

View File

@ -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=
<head>
%s
</head>
<body style="width: %dpx">
<body style="width: %dpx; background: white">
<style type="text/css">
table {%s}
</style>