From f3629019315427e00001eac30155941aa21cd191 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Nov 2019 15:10:36 +0530 Subject: [PATCH] PDF Output: Workaround for weird added anchor markup rendering with Qt 5.13.2 --- src/calibre/ebooks/pdf/html_writer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py index cf2e67a8c1..8fca067aab 100644 --- a/src/calibre/ebooks/pdf/html_writer.py +++ b/src/calibre/ebooks/pdf/html_writer.py @@ -408,14 +408,15 @@ def add_anchors_markup(root, uuid, anchors): body = last_tag(root) div = body.makeelement( XHTML('div'), id=uuid, - style='display:block; page-break-before: always; break-before: always;' + style='display:block !important; page-break-before: always !important; break-before: always !important; white-space: pre-wrap !important' ) + div.text = '\n\n' body.append(div) def a(anchor): a = div.makeelement( XHTML('a'), href='#' + anchor, - style='white-space: pre; min-width: 10px; min-height: 10px; border: solid 1px;' + style='min-width: 10px !important; min-height: 10px !important; border: solid 1px !important;' ) a.text = a.tail = ' ' div.append(a)