Re: How to find coordonnates of word and apply a mask

2024-02-12 Thread Tilman Hausherr
In PDF y=0 is bottom, in java it is top. See also the javadoc of the text.getXXX methods. It's a bit tricky, you need to do some trial and error. Tilman On 12.02.2024 21:07, Frédéric Ravetier wrote: You said Y coordinate is not the same on pdf, this is probably my problem on my pdf. How to

Re: How to find coordonnates of word and apply a mask

2024-02-12 Thread Frédéric Ravetier
You said Y coordinate is not the same on pdf, this is probably my problem on my pdf. How to get the right Y for the pdf? On my test the x seems OK but not the Y. Le lun. 12 févr. 2024, 19:30, Frédéric Ravetier a écrit : > My goal is to draw on the same or a copy PDF a rectangle over the

Re: How to find coordonnates of word and apply a mask

2024-02-12 Thread Frédéric Ravetier
My goal is to draw on the same or a copy PDF a rectangle over the text, for example to hide it or to draw a border around the text to show to the user something about this text. Le lun. 12 févr. 2024 à 19:14, Tilman Hausherr a écrit : > It depends what you want to get. See the

Re: How to find coordonnates of word and apply a mask

2024-02-12 Thread Tilman Hausherr
It depends what you want to get. See the DrawPrintTextLocations.java example which shows several strategies to get the bounding boxes of individual glyphs and draw them on the screen (not in a PDF, so the Y coordinate is different). You would have to adjust the "Rectangle2D.Float" code to

How to find coordonnates of word and apply a mask

2024-02-12 Thread Frédéric Ravetier
Hello, I'd like to find some specific words in a PDF and draw a rectangle over these words. I'm using PDFBox 3.0.1 I found this to locate the words : https://github.com/mkl-public/testarea-pdfbox2/blob/master/src/test/java/mkl/testarea/pdfbox2/extract/ExtractWordCoordinates.java As you can see