get X,Y co-ordinates of the selected area from PDF
Asked Answered
D

0

8

I'm trying to extract text from a particular section of a PDF. If I know the X,Y co-ordinates of the area, I'm able to extract the text. But I'm unable to get the co-ordinates of the selected area from PDF. Kindly help me If anyone tried this already.

Deccan answered 25/6, 2014 at 4:14 Comment(5)
Can you explain what you mean. You say that you have X,Y coordinates. You know how to extract text. But which X,Y coordinates do you further need? This looks like a duplicate of #23910393Rhiamon
Actually I've hard coded the X,Y co-ordinates to extract text. What I need is, When I display the PDF in the browser and selects an area, I need the co-ordinates of the selection. One more doubt I have is, If we get co-ordinates from the browser, Will it be match with Original PDF's co-ordinates.Deccan
The coordinate system in the browser is different from the coordinate system in PDF. There will be differences. This question seems to move more in the direction of pdf.js than in the direction of iText.Rhiamon
I'm with @BrunoLowagie, this is a client-side problem so iText and PDFbox aren't involved. PDF.js parses a PDF and renders it to the HTML canvas. Knowing that you can just monitor the HTML canvas and ignore the PDF completed. This answer has a sample that might help: https://mcmap.net/q/1069839/-plot-coordinates-on-pdf-displayed-in-iframeAfterpiece
Thanks BrunoLowagie and Chris Haas. PDF.js has what I expected...Deccan

© 2022 - 2024 — McMap. All rights reserved.