pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allison, Timothy B." <talli...@mitre.org>
Subject RE: associating text with a PDActionURI?
Date Thu, 07 Jul 2016 12:37:45 GMT
Sorry, duh, I switched to overriding writeString(String text, List<TextPostion> positions)
instead of writeString(String text).

I can calculate x overlap, but I can't figure out how to get overlap on y.

The file is here: https://git-wip-us.apache.org/repos/asf?p=tika.git;a=blob_plain;f=tika-parsers/src/test/resources/test-documents/testPDFVarious.pdf;hb=636060eb6c4a2ea4960ccc045f8bc5ae159c9117


PDAnnotationLink's rectangle is: 
(lowerleftx) 69.75 : (lly)351.17 : (upperrightx)153.45 : (upry)376.62

"This is a hyperlink" has locations:
x: 72.024 xDirAdj: 72.024 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 77.40048 xDirAdj: 77.40048 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 83.19648 xDirAdj: 83.19648 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 85.73568 xDirAdj: 85.73568 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 90.05232 xDirAdj: 90.05232 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 92.54736 xDirAdj: 92.54736 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 95.08656 xDirAdj: 95.08656 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 99.403206 xDirAdj: 99.403206 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 101.89825 xDirAdj: 101.89825 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 107.18641 xDirAdj: 107.18641 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 109.68145 xDirAdj: 109.68145 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 115.34497 xDirAdj: 115.34497 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 120.37921 xDirAdj: 120.37921 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 126.14209 xDirAdj: 126.14209 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 131.64001 xDirAdj: 131.64001 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 135.49298 xDirAdj: 135.49298 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 138.03218 xDirAdj: 138.03218 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 140.57138 xDirAdj: 140.57138 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 146.30115 xDirAdj: 146.30115 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52
x: 151.22 xDirAdj: 151.22 y: 425.93 yDirAdj: 425.93 height: 5.52 heightDir: 5.52



-----Original Message-----
From: Allison, Timothy B. [mailto:tallison@mitre.org] 
Sent: Thursday, July 7, 2016 8:04 AM
To: users@pdfbox.apache.org
Subject: associating text with a PDActionURI?

All,

Is there a recipe for associating a hyperlink to text on the page?  Over on Tika, we're dumping
these as <a href=""/> at the end of each page.  If it isn't too hard, it would be great
to associate these links with text, e.g. <a href="http://tika.apache.org">tika</a>.

This is related to PDFBOX-1143 and TIKA-2029.

I see how to get the rectangle on the PDAnnotationLink, but I'm not sure how to grab the coordinates
in PDFTextStripper's writeString()...or is that even the right method?

Thank you!

         Best,

                    Tim


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message