mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-27 17:22:34 -04:00
EPUB metadata: When rendering the first page as cover, render it as XHTML. This means that if the EPUB is not valid XHTML the cover wont be rendered correctly. Necessary for rendering of SVG elements in the page when it does not have an .xhtml extension. Fixes #7909 (Issue with HarperCollins EPUB Covers)
This commit is contained in:
@@ -122,7 +122,11 @@ def render_html(path_to_html, width=590, height=750):
|
||||
renderer = HTMLRenderer(page, loop)
|
||||
page.connect(page, SIGNAL('loadFinished(bool)'), renderer,
|
||||
Qt.QueuedConnection)
|
||||
page.mainFrame().load(QUrl.fromLocalFile(path_to_html))
|
||||
# Can't use load as if the extension of path is not xhtml
|
||||
# then it won't render SVG correctly, so set mimetype
|
||||
# explicitly
|
||||
page.mainFrame().setContent(open(path_to_html, 'rb').read(),
|
||||
'application/xhtml+xml', QUrl.fromLocalFile(path_to_html))
|
||||
loop.exec_()
|
||||
renderer.loop = renderer.page = None
|
||||
del page
|
||||
|
||||
Reference in New Issue
Block a user