Getting page coordinates interchangable(Height, Width) with new(1.19.4) and old version(1.16.7) #1630
Replies: 5 comments 2 replies
-
Please be more specific: |
Beta Was this translation helpful? Give feedback.
-
@JorjMcKie , Yes page coordinates are interchanging without rotation. (page.height, page.width) |
Beta Was this translation helpful? Give feedback.
-
The following is normal, expected behavior: page.set_rotation(90)
pprint(page.get_text("dict"))
{'blocks': [{'bbox': (100.0,
88.17500305175781,
211.2539520263672,
103.28900146484375),
'lines': [{'bbox': (100.0,
88.17500305175781,
211.2539520263672,
103.28900146484375),
'dir': (1.0, 0.0),
'spans': [{'ascender': 1.0750000476837158,
'bbox': (100.0,
88.17500305175781,
211.2539520263672,
103.28900146484375),
'color': 0,
'descender': -0.29899999499320984,
'flags': 0,
'font': 'Helvetica',
'origin': (100.0, 100.0),
'size': 11.0,
'text': 'just some arbitrary text'}],
'wmode': 0}],
'number': 0,
'type': 0}],
'height': 842.0,
'width': 595.0}
page.rect.width
842.0 |
Beta Was this translation helpful? Give feedback.
-
@JorjMcKie , Why we are getting different values for page_dict.get('width', 0) and page.rect.width Answer841.8897094726562 595.2755737304688 595.2755737304688 |
Beta Was this translation helpful? Give feedback.
-
I really don't know what you are trying to report. Look at this: Python 3.9.8 (tags/v3.9.8:bb3fdcf, Nov 5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import fitz
>>> print(fitz.__doc__)
PyMuPDF 1.19.4: Python bindings for the MuPDF 1.19.0 library.
Version date: 2022-01-01 00:00:01.
Built for Python 3.9 on win32 (64-bit).
>>> doc=fitz.open("topLeftImage.pdf")
>>> page=doc[0]
>>> from pprint import pprint
>>> pprint(page.get_text("dict",flags=0))
{'blocks': [{'bbox': (193.49000549316406,
114.74002075195312,
195.98587036132812,
125.78002166748047),
'lines': [{'bbox': (193.49000549316406,
114.74002075195312,
195.98587036132812,
125.78002166748047),
'dir': (1.0, 0.0),
'spans': [{'ascender': 0.75,
'bbox': (193.49000549316406,
114.74002075195312,
195.98587036132812,
125.78002166748047),
'color': 0,
'descender': -0.25,
'flags': 0,
'font': 'Calibri',
'origin': (193.49000549316406,
123.02001953125),
'size': 11.039999961853027,
'text': ' '}],
'wmode': 0}],
'number': 0,
'type': 0}],
'height': 792.0,
'width': 612.0}
>>> page.rect.width
612.0
>>> page.rect.height
792.0
>>> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, If anyone facing similar issue? For some of the documents, I am facing this issue. Page coordinates are interchanging.
Height = 595.2755737304688 Width = 841.8897094726562 <- New Version
Height = 841.8897094726562 Width = 595.2755737304688 <- Old Version
Beta Was this translation helpful? Give feedback.
All reactions