Pdf.js: Enable automatic URL hyperlinking

Created on 29 Apr 2013  路  11Comments  路  Source: mozilla/pdf.js

In Adobe Reader by default anything with a www is being recognized as a URL and becomes linkable.
It does not seem like the same thing works in pdf.js

1-viewer 2-feature

Most helpful comment

Hi guys, any updates on this? Will it be implemented?

All 11 comments

Any recent version of Firefox lets you right-click on anything that looks enough like an URL and then do "Open Link".

We have experienced this issue as well, especially in IE. We love the viewer so far, and that is the only issue we have come across. Do you think there will be a solution soon?

@curliesue64 #3744 will probably address this.

@timvandermeij Unfortunately this issue will not be fixed by that PR, since they are not the same.
This issue is about automatically creating hyperlinks from _any_ piece of text, which looks like a link. To implement this, you would have to check the content of _every_ <div> in the textLayer. I'm not sure if we would want to do this, and if it was implemented it should certainly not be on by default.

One solution would be to use something like this: https://github.com/gregjacobs/Autolinker.js

@timvandermeij the pdf attached #6686 does have a hyperlink which is on the bottom left of the page. which takes me to http://www.cameronmoll.com/

can you please please re-check

thanks in advance

It will be easier to implement it after #6689 (Also #6590 shall help with this a lot).

Hi guys, any updates on this? Will it be implemented?

Hi, any updates? Will it be implemented soon?

This is not something I think anyone is working on. Moreover, it's far from trivial to implement since you'd have to detect URLs in text fragments that may be split up at any point in the document due to the way the PDF format handles text.

My solution was accessing the annotation layer, and putting links on a separate layer from the PDF canvas.
Here is a nice jsfiddle solution I found.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patelsumit5192 picture patelsumit5192  路  3Comments

xingxiaoyiyio picture xingxiaoyiyio  路  3Comments

THausherr picture THausherr  路  3Comments

PeterNerlich picture PeterNerlich  路  3Comments

smit-modi picture smit-modi  路  3Comments