Skip to content

Commit

Permalink
修正目录里的页码
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctocell committed Nov 13, 2024
1 parent 7bebbac commit e00b4d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ def generate_toc(nodes: List[DocTreeNode], tempdir) -> List[tuple[int, str, int]
toc_no_page_numbers = list(map(lambda node: node.toc_entry, nodes))
toc = []
page_number = 1
if COVER_PDF_PATH:
with pymupdf.open(COVER_PDF_PATH) as cover_page:
page_number += cover_page.page_count
for index, node in enumerate(nodes):
(title, level) = toc_no_page_numbers[index]
path = os.path.join(tempdir, f'{index}.pdf')
Expand Down

0 comments on commit e00b4d0

Please sign in to comment.