The coordinates before and after the page are inconsistent #1866
-
Hello, I have a problem with parsing pdf. The reason is that I want to move the embedded image of one page to another page, but the coordinates of the pdf in the original page are (90.0, 78.72003173828125, 520.7999877929688, 766.4400024414062), but The coordinates in the new page are (90.0, 126.75018310546875, 520.7999877929688, 718.4097900390625), what is the reason for this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This code is as follows: pageWr_embed = docWr1.new_page(width=fitz_page.rect.width, height=fitz_page.rect.height) for block in pageWr_embed.get_text('dict')['blocks']: |
Beta Was this translation helpful? Give feedback.
-
This should not happen for images that are unrotated / rotated by int multiples of 90 degrees. |
Beta Was this translation helpful? Give feedback.
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)