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

Free Support Forum - aspose.com

Html to pdf hyperlinks


I am trying convert html file into pdf using:

LoadOptions loadOptions = new LoadOptions();

Document doc = new Document(htmlFile.getAbsolutePath(), loadOptions);
DocumentBuilder builder = new DocumentBuilder(doc);


Generated pdf looks great, but local hyperlinks () are not working. Is there any way to solve it please?

Thank you.

Hi there,

Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.


thank you for your reply.
I am attaching sample source html file and generated pdf file (in zip).
Links at table of contents are working, but links at the end of the document are not.

Hi there,

Thanks for sharing the detail. Please note that Aspose.Words mimics the same behavior as MS Word does. If you load the html in MS Word and save it to Pdf, you will get the same output.

I have logged this issue as WORDSNET-12352 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Hi there,

Thanks for your patience.

It is to inform you that our development team has completed the work on the issue (WORDSNET-12352)
and has come to a conclusion that this issue and the
undesired behavior you’re observing is actually not a bug in
Aspose.Words. So, we have closed this issue as ‘Not a Bug’. I am quoting developer’s comments here:

On importing the customer’s html MS Word creates hyperlink fields with the following codes:
HYPERLINK “” \l "deps"
HYPERLINK “” \l "some"

But, actually, “deps” and “some” do not match any bookmarks or other marked locations in the document. It seems, MS Word just searches for the first occurrence of the text after the \l switch and navigates to that text to follow the link.

As other programs such as pdf readers do not implement searching for a word when following such links, they do not work as MS Word with the exported file either. In order for the link to work the bookmark it references must be actually present in the document structure. For example, to make the “deps” link work, the following may be added to the source html: