mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Fix rendering of tables to images to not always create full page images
This commit is contained in:
parent
d3075d1636
commit
d0106bd4a0
@ -46,9 +46,11 @@ class HTMLTableRenderer(QObject):
|
|||||||
painter = QPainter(image)
|
painter = QPainter(image)
|
||||||
self.page.mainFrame().render(painter)
|
self.page.mainFrame().render(painter)
|
||||||
painter.end()
|
painter.end()
|
||||||
|
cheight = image.height()
|
||||||
|
cwidth = image.width()
|
||||||
pos = 0
|
pos = 0
|
||||||
while pos < cheight:
|
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
|
pos += cutoff_height-20
|
||||||
if cwidth > self.width:
|
if cwidth > self.width:
|
||||||
img = img.scaledToWidth(self.width, Qt.SmoothTransform)
|
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>
|
<head>
|
||||||
%s
|
%s
|
||||||
</head>
|
</head>
|
||||||
<body style="width: %dpx">
|
<body style="width: %dpx; background: white">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
table {%s}
|
table {%s}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user