Skip to content

Question: how is word's origin computed? #846

Answered by JorjMcKie
VeryLazyBoy asked this question in Q&A
Discussion options

You must be logged in to vote

I am wondering if I need to correct the media box and crop box first to insert a text properly?

No, don't do that. This will break the position of other stuff on the page.
I will need to adjust PyMuPDF to accomodate this weird situation.
In the meantime subtract page.MediaBox.y0 from the desired insertion y-position as a workaround. In "normal" cases this value will be zero and do no harm.
So in your case, page.insertText((100, 100 - page.MediaBox.y0), "hello") should make it.

Replies: 8 comments

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
Answer selected by JorjMcKie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #840 on January 20, 2021 22:40.