Skip to content

The coordinates before and after the page are inconsistent #1866

Answered by zhongJY1998
zhongJY1998 asked this question in Q&A
Discussion options

You must be logged in to vote

This code is as follows:

pageWr_embed = docWr1.new_page(width=fitz_page.rect.width, height=fitz_page.rect.height)
text_dict = fitz_page.get_text('dict')
for block in text_dict['blocks']:
if block["type"] == 1:
# block['bbox']: (90.0, 78.72003173828125, 520.7999877929688, 766.4400024414062)
pageWr_embed.insert_image(block['bbox'], stream=block['image'])

for block in pageWr_embed.get_text('dict')['blocks']:
if block["type"] == 1:
print('new coord: ', block['bbox']) # (90.0, 126.75018310546875, 520.7999877929688, 718.4097900390625)

Replies: 2 comments

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 #1865 on August 09, 2022 07:51.