mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PDF Output: Handle empty anchors present at the end of a page
This commit is contained in:
parent
d4819097f4
commit
a592ab85f9
@ -345,8 +345,8 @@ class PdfDevice(QPaintDevice): # {{{
|
||||
return int(round(self.body_height * self.ydpi / 72.0))
|
||||
return 0
|
||||
|
||||
def end_page(self):
|
||||
self.engine.end_page()
|
||||
def end_page(self, *args, **kwargs):
|
||||
self.engine.end_page(*args, **kwargs)
|
||||
|
||||
def init_page(self):
|
||||
self.engine.init_page()
|
||||
|
@ -279,6 +279,7 @@ class PDFWriter(QObject):
|
||||
if self.doc.errors_occurred:
|
||||
break
|
||||
|
||||
self.doc.add_links(self.current_item, start_page, amap['links'],
|
||||
amap['anchors'])
|
||||
if not self.doc.errors_occurred:
|
||||
self.doc.add_links(self.current_item, start_page, amap['links'],
|
||||
amap['anchors'])
|
||||
|
||||
|
@ -17,10 +17,14 @@ from calibre.ebooks.pdf.render.common import Array, Name, Dictionary, String
|
||||
class Destination(Array):
|
||||
|
||||
def __init__(self, start_page, pos, get_pageref):
|
||||
super(Destination, self).__init__(
|
||||
[get_pageref(start_page + pos['column']), Name('XYZ'), pos['left'],
|
||||
pos['top'], None]
|
||||
)
|
||||
pnum = start_page + pos['column']
|
||||
try:
|
||||
pref = get_pageref(pnum)
|
||||
except IndexError:
|
||||
pref = get_pageref(pnum-1)
|
||||
super(Destination, self).__init__([
|
||||
pref, Name('XYZ'), pos['left'], pos['top'], None
|
||||
])
|
||||
|
||||
class Links(object):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user