Not able to read Hyperlink Text inside a rectangle for most of the pdf document

I am trying to read the text inside a rectangle from a pdf document. ratio of working to not working is 25% : 75%
I have used the following code, but Its not working for most of the documents. The code is as below :

private static String getHyperlinkText(Page currentPage, LinkAnnotation hyplnkAction) {
TextAbsorber absorber = new TextAbsorber();
Rectangle rectangle = hyplnkAction.getRect();
TextSearchOptions options = new TextSearchOptions(rectangle);
// get the text associated with hyperlink
return absorber.getText();


Thank you for contacting support.

Would you please share a few sample documents where it works and where it does not. Also share the code where this method is called so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for Java 19.10.

Hi Farhan,
I was using aspose 19.2 where i was unable to fetch tect inside rectangle, but after I used aspose 19.11 I was able to read text inside rectangle.



It is good to know that your issue has been resolved by using latest version of the API. Please keep using our API and in case you face any issue, please feel free to let us know.

1 Like