mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
PDF Output: Fix a regression in the previous release that broke conversion to PDF for some files. Fixes #1689192 [Private bug](https://bugs.launchpad.net/calibre/+bug/1689192)
This commit is contained in:
parent
5a5406b5d5
commit
acba68e240
@ -351,15 +351,15 @@ class PDFWriter(QObject):
|
||||
evaljs(self.paged_js)
|
||||
self.load_mathjax()
|
||||
|
||||
amap = evaljs('''
|
||||
amap = json.loads(evaljs('''
|
||||
document.body.style.backgroundColor = "white";
|
||||
paged_display.set_geometry(1, %d, %d, %d);
|
||||
paged_display.layout();
|
||||
paged_display.fit_images();
|
||||
ret = book_indexing.all_links_and_anchors();
|
||||
window.scrollTo(0, 0); // This is needed as getting anchor positions could have caused the viewport to scroll
|
||||
ret;
|
||||
'''%(self.margin_top, 0, self.margin_bottom))
|
||||
JSON.stringify(ret);
|
||||
'''%(self.margin_top, 0, self.margin_bottom)))
|
||||
|
||||
if not isinstance(amap, dict):
|
||||
amap = {'links':[], 'anchors':{}} # Some javascript error occurred
|
||||
|
@ -247,10 +247,10 @@ class Document(QWebPage): # {{{
|
||||
self.first_load = False
|
||||
|
||||
def colors(self):
|
||||
ans = self.javascript('''
|
||||
ans = json.loads(self.javascript('''
|
||||
bs = getComputedStyle(document.body);
|
||||
[bs.backgroundColor, bs.color]
|
||||
''')
|
||||
JSON.stringify([bs.backgroundColor, bs.color])
|
||||
'''))
|
||||
return ans if isinstance(ans, list) else ['white', 'black']
|
||||
|
||||
def read_anchor_positions(self, use_cache=True):
|
||||
@ -299,8 +299,8 @@ class Document(QWebPage): # {{{
|
||||
def column_boundaries(self):
|
||||
if not self.loaded_javascript:
|
||||
return (0, 1)
|
||||
ans = self.javascript(u'paged_display.column_boundaries()')
|
||||
return tuple(int(x) for x in ans)
|
||||
ans = self.javascript(u'JSON.stringify(paged_display.column_boundaries())')
|
||||
return tuple(int(x) for x in json.loads(ans))
|
||||
|
||||
def after_resize(self):
|
||||
if self.in_paged_mode:
|
||||
|
Loading…
x
Reference in New Issue
Block a user