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

Free Support Forum - aspose.com

Hyperlinks not working

Hi,





I am using Aspose.pdf 11.5 version. My html content has hyperlinks in it. Hyperlinks are not clickable in pdf file. How can I make it work.



Here is the sample code:

HtmlFragment fgmt = new HtmlFragment(“Google”);

page.getParagraphs().add(fgmt);



Thanks

Mamatha

Hi Mamatha,


Thanks for your inquriy. I have tested the scenario and noticed that Hyperlink is being added as flat text, so logged a ticket PDFJAVA-35876 in our issue tracking system for further investigation and rectification.

We are sorry for the inconvenience caused.

Best Regards,

Hi,

If possible can you please provide workaround for this until it is fixed.

Thanks
Mamatha

Hi Mamatha,


Thanks for your inquriy. As a workaround ,you may set Hyperlink property of TextSegment as following. However we will notify you as soon as your above reported issue is resolved.

TextFragment textFragment = new TextFragment("Normal black
text "
);<o:p></o:p>

TextSegment seg1= new TextSegment("Bold black text ");

seg1.getTextState().setFontStyle(FontStyles.Bold);

TextSegment seg2= new TextSegment("Red text ");

seg2.getTextState().setForegroundColor(com.aspose.pdf.Color.getRed());

TextSegment hyperlink_seg = new TextSegment("Google");

hyperlink_seg.setHyperlink(new WebHyperlink("www.google.com"));

hyperlink_seg.getTextState().setForegroundColor(com.aspose.pdf.Color.getBlue());

hyperlink_seg.getTextState().setFontStyle(FontStyles.Italic);

textFragment.getSegments().add(seg1);

textFragment.getSegments().add(seg2);

textFragment.getSegments().add(hyperlink_seg);

page.getParagraphs().add(textFragment);


Best Regards,

Tilal,

Thanks for the workaround. But it doesn’t solve our purpose. Do you know when this issue will be fixed.

Thanks
Mamatha

Hi Mamatha,


Thanks for your patience.

As we recently have noticed earlier reported issue, so its pending for review and is not yet resolved. However the product team will surely consider investigating/fixing it as per development schedule and as soon as we have some definite updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this delay and inconvenience.
Hi,

We noticed the following when using HtmlFragment for hyperlinks.

Hyperlink is clickable in PDF when we use following code

HtmlFragment fgmt = new HtmlFragment("
<a href=\"http://www.example.com\">WWW Example ");
page.getParagraphs().add(fgmt);


Hyperlink is NOT clickable in PDF when we use following code.

HtmlFragment fgmt = new HtmlFragment("<a href=\"http://manage.example.com\">Manage Example ");
page.getParagraphs().add(fgmt);

-Mamatha

Hi Mamatha,


Thanks for sharing the details.

As per my observations when using following code snippet, both links are not clickable. Can you please share your code snippet and output being generated at your end. We are sorry for this inconvenience.

[Java]

com.aspose.pdf.Document doc = new
com.aspose.pdf.Document();<o:p></o:p>

doc.getPages().add();

HtmlFragment fgmt = new HtmlFragment("WWW Example ");

doc.getPages().get_Item(1).getParagraphs().add(fgmt);

HtmlFragment fgmt1 = new HtmlFragment("Manage Example ");

doc.getPages().get_Item(1).getParagraphs().add(fgmt1);

doc.save("c:/pdftest/HTML_in_PDF.pdf");

Can you please provide update on this.

Hi Mamatha,


Thanks for your patience.

The product team has started investigating earlier reported issue PDFJAVA-35876 but I am afraid due to some technical difficulties, the problem is not yet resolved. However as soon as we have some further updates, we will let you know.

Hi,

Update please.

We have bought the license and code is in production now. We need a fix for this feature ASAP. Please provide ETA for this.

Thanks
Mamatha

Hi Mamatha,

Thanks for your patience.

The product team started investigating earlier reported issue but due to some limitations in our API (dependency on issue fix in Aspose.Pdf for .NET, which is sibling of Aspose.Pdf for Java), the problem is not yet resolved. However I have shared your concerns with product team and as soon as we have some definite updates regarding its resolution, we will let you know.

Hi,


Can you please provide update on this.

Thanks
Mamatha

Hi Mamatha,


Thanks for your inquiry. I am afraid the subjected issue is still pending for review as the team is busy in resolving other issues in the queue. However we have recorded your concern and also raised the issue priority. We will notify you as soon as we made some significant progress towards issue resolution.

Thanks for your patience and cooperation.

Best Regards,

The issues you have found earlier (filed as PDFJAVA-35876) have been fixed in Aspose.Pdf for Java 17.4.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.