Skip to content
Discussion options

You must be logged in to vote

@JorjMcKie I was able to solve this problem.. ofcourse need to fine tune this.. just sharing here the idea and it works :-)

The trick

When writing links i am using an actual url with the following format

https://example.org/{page_no},{point_x},{point_y}

I am able to get the above info by calling chapter_file.get_toc(simple=False)

After the save operation is done i am opening the pdf again and rewriting the links acquired from page.get_links().

I am opening the same file after save(output) because the page.get_links() is not returning the links exactly after page.insert_htmlbox. Itried doing the page.refresh() but no luck there as of now.

Code

# Run the following exactly after pymupdf.save…

Replies: 12 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JorjMcKie
Comment options

@JorjMcKie
Comment options

@kishaningithub
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@JorjMcKie
Comment options

@kishaningithub
Comment options

Comment options

You must be logged in to vote
1 reply
@JorjMcKie
Comment options

Answer selected by JorjMcKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
not a bug not a bug / user error / unable to reproduce wontfix no intention to resolve
2 participants
Converted from issue

This discussion was converted from issue #4981 on May 05, 2026 12:50.