mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont delete toc pages if they empty PDF file
This commit is contained in:
parent
fdc0c7cf7e
commit
c091461b99
@ -528,7 +528,8 @@ def get_anchor_locations(pdf_doc, first_page_num, toc_uuid):
|
|||||||
ans = {}
|
ans = {}
|
||||||
anchors = pdf_doc.extract_anchors()
|
anchors = pdf_doc.extract_anchors()
|
||||||
toc_pagenum = anchors.pop(toc_uuid)[0]
|
toc_pagenum = anchors.pop(toc_uuid)[0]
|
||||||
pdf_doc.delete_pages(toc_pagenum, pdf_doc.page_count() - toc_pagenum + 1)
|
if toc_pagenum > 1:
|
||||||
|
pdf_doc.delete_pages(toc_pagenum, pdf_doc.page_count() - toc_pagenum + 1)
|
||||||
for anchor, loc in iteritems(anchors):
|
for anchor, loc in iteritems(anchors):
|
||||||
loc = list(loc)
|
loc = list(loc)
|
||||||
loc[0] += first_page_num - 1
|
loc[0] += first_page_num - 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user