Hello Tilman, Yes, I used the rotation magic as you advised and captured the angle of rotation and applied the correct linear algebra formula; Where I went astray was in the fact that I used the incorrect value from the TextPosition. Having read a great many StackOverflow articles, I realized I should use TextPosition.getTextMatrix().getTranslateX() and the corresponding value for the y to return the coordinates of the start of the string in the unrotated space. A classic error. Hopefully posting this means that others don't fall into to the same trap.
Have a great weekend. On Wednesday, June 3, 2020, 7:31:54 PM GMT+1, Tilman Hausherr <thaush...@t-online.de> wrote: Hi, The ExtractText tool (in the tools subproject) has a "magicRotation" option, did you try that one? Tilman Am 03.06.2020 um 15:14 schrieb PDF Developer: > Hello, > I've experimented with the Extract Text Sample and have been successful in > extracting text. As a requirement, I only extract text that is in a certain > named separation and at (integer) rotation angle values. > > Now there is a requirement to get the start (x,y) position of the each of the > rotated text strings. I tried capturing the TextPostion of the start of the > line during the extraction process (writeString) and then applying a "reverse > rotation" using the geometric x'=xcosθ-ysinθ etc. formula" but that didn't > appear to give the correct results, as I am seeing negative coordinate > values. I suspect that there is a matrix transformation that I am missing. > > Now I may have misunderstood the process here, so if someone could point me > in the right direction then I would appreciate that. > > Thanks in advance. > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org