We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multi-line LinkAnnotation issue, No hyperlink created when link text scattered to new line

Dear Team,

We have purchased Aspose.Pdf for Java Site OEM license with Enterprise Support.
We have following issue with current version of API. Could you please help us to resolve these issues?

ISSUE:

Multi-line link annotation issue: When in a paragraph words created at end of line like this [This is Multi Line Link] . The API is not able to create Hyperlink properly. However, its working fine the link text is there in the same line, so the issue is when the link text is in next line. Following are the code snippet to create link annotation.

CODE SNIPPET:

// Get rectangular dimensions of TextFragment object
Rectangle rect = new Rectangle((float) textFragment.getPosition().getXIndent(), (float) textFragment.getPosition().getYIndent(), (float) textFragment.getPosition().getXIndent() + (float) textFragment.getRectangle().getWidth(), (float) textFragment.getPosition().getYIndent() + (float) textFragment.getRectangle().getHeight());

// Create LinkAnnotation object and specify rectangular region
LinkAnnotation link = new LinkAnnotation(textFragment.getPage(), rect);

// Set target file
link.setAction(new GoToRemoteAction(remotePDF, remotePageNumber));

// Add annotation to annotations collection of TextFragment
textFragment.getPage().getAnnotations().add(link);

Could you please let us know the right solution with example code snippets.
Highly appreciate for your support and resolution.

Thanks & Regards,
Radha Krishna Garnepudi

@grk_aspose

Thank you for contacting support.

You may Add Hyperlink in a PDF file which can be a multi-line or a single line hyperlink, as per your requirements.

We hope this will be helpful. Please share SSCCE code along with source and generated files with us in case you face any problem.