if(textStrings == null)
{textStrings = extractor.extract(page);}
Link link = (Link)annotation;
Rectangle2D linkBox = link.getBox();
// Text.
/*
Extracting text superimposed by the link...
NOTE: As links have no strong relation to page text but a weak location correspondence,
we have to filter extracted text by link area.
*/
StringBuilder linkTextBuilder = new StringBuilder();
for(ITextString linkTextString : extractor.filter(textStrings,linkBox))
{linkTextBuilder.append(linkTextString.getText());}
System.out.println("Link '" + linkTextBuilder + "' ");
// Position.
System.out.println(
" Position: "
+ "x:" + Math.round(linkBox.getX()) + ","
+ "y:" + Math.round(linkBox.getY()) + ","
+ "w:" + Math.round(linkBox.getWidth()) + ","
+ "h:" + Math.round(linkBox.getHeight())
);
// Target.
System.out.print(" Target: ");
PdfObjectWrapper<?> target = link.getTarget();