Text Positions #1802
-
I have extracted rect values of text positions from a PDF. I want to insert text based on the positions extracted. Can you let me know if text matrix(Tm) values of a PDF can be obtained based on rect values? Is there any difference between rect values of text and text matrix values? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
The text matrix The bbox accompanying extracted text always already contains any computations required to deliver the correct value. So you can use those bboxes (plus the |
Beta Was this translation helpful? Give feedback.
The text matrix
Tm
in PDF/Contents
source is not directly available. Its use is also not intended in PyMuPDF - although you could of course read the/Contents
as a stream and dig your way through to all information you want.The bbox accompanying extracted text always already contains any computations required to deliver the correct value.
So you can use those bboxes (plus the
span["origin"]
- which is even more important) for inserting the span text.