Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Suggestion: Include hyperlink action in PDF output for hyperlinks in webpage #10196

Closed
ariya opened this issue Aug 22, 2011 · 100 comments
Closed
Labels

Comments

@ariya
Copy link
Owner

ariya commented Aug 22, 2011

Guido...@gmail.com commented:

PhantomJS v1.2.0

If you rasterie the URL http://www.nu.nl/buitenland/2590433/voedselhulp-wordt-in-mogadishu-gestolen-.html, it contains selectable text in PDF. Which is great!

But this news page contains a lot of link when opened in a normal browser.
The PDF output shows no similar hyperlinks on the available text.

My suggestion: associate a hyperlink action where relevant.

This allows the PDF to more resemble the actual website.

Disclaimer:
This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #196.
🌟   8 people had starred this issue at the time of migration.

@ariya
Copy link
Owner Author

ariya commented Aug 22, 2011

ariya.hi...@gmail.com commented:

Probably need to fix Qt PDF code for this.

 
Metadata Updates

  • Label(s) removed:
    • Type-Defect
  • Label(s) added:
    • Type-Enhancement

@ariya
Copy link
Owner Author

ariya commented May 2, 2012

j...@devantlatele.com commented:

There was a bug in Webkit recently where hyperlinks were not included in the PDF output, that's been fixed. Safari's PDF output had the problem too for some months. It's fixed now. So maybe getting a more recent version of webkit will fix the issue.

@ghost
Copy link

ghost commented Nov 1, 2012

teddy...@gmail.com commented:

Hi, I have upgraded to v1.7 and I still can't get clickable hyperlinks in any PDF output. I have tried it with the Quickstart examples too.

@JamesMGreene
Copy link
Collaborator

james.m....@gmail.com commented:

Related discussion, including links to bugs and patches for wkhtml2pdf: https://groups.google.com/d/topic/phantomjs/DuCbXTEnhRc/discussion

 
Metadata Updates

  • Status updated: Accepted

@ariya
Copy link
Owner Author

ariya commented Jan 24, 2013

j...@devantlatele.com commented:

More details :

Here is the original but report in Webkit:

"Bug 65076 - WebKit2: Printing to PDF loses URL links"

https://bugs.webkit.org/show_bug.cgi?id=65076

It got fixed in Safari 5.1.4, which uses ..

http://en.wikipedia.org/wiki/Safari_version_history

... webkit 534.54.16

Using /examples/useragent.js with Phantom 1.8.1 i just upgraded to i get :

The default user agent is Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.8.1 Safari/534.34

And 534.34 is still behind 534.54

Hope it helps.

@thom4parisot
Copy link

tho...@oncle-tom.net commented:

And since, have you tried rastering an HTML page containing hyperlinks to
PDF and getting them clickable?

Because it's related to a QT lib, not Webkit directly.

@ariya
Copy link
Owner Author

ariya commented Jan 24, 2013

j...@devantlatele.com commented:

I tried, and they are still not clickable.

i don't know if the patch used in the webkit bug report :

https://bug-65076-attachments.webkit.org/attachment.cgi?id=121534

.. is applicable to qtwebkit, it looks like a fix for Safari only, no?
(i'm not familiar at all with webkit's code and how qtwebkit relates to it)
i understand they switched to using PDF Kit, i don't know what is the equivalent od PDF Kit used by qtwebkit.

[On the other end, another issue with page-break-before: always; seems to work for me now.]

@passoir
Copy link

passoir commented Mar 23, 2013

It seems the wkhtmlpdf has the clickable links in generated pdf file. Is it possible to apply their webkit patch to phantomjs?

@wachunga
Copy link

wachunga commented Apr 1, 2013

FWIW, my links are clickable when the pdf is generated on Ubuntu 12.04.1, but not on my mac (10.6.8).

@ddooley
Copy link

ddooley commented Apr 15, 2013

I have phantomjs 1.9.0 on ubuntu 12.04.2 but no clickable links.

@AndrewEastwood
Copy link

I have the same issue (1.9.0 on Ubuntu 11.10)

@duybinh0208
Copy link

In summary, Can anyone give me the exactly solution for this problem? I'm using phantomjs 1.9 in windows and The default user agent is Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.0 Safari/534.34 Your Http User Agent string is: SpecialAgent.

@ddooley
Copy link

ddooley commented Jun 5, 2013

I feel in the dark too. I tried compiling webkit on my ubuntu 12.10.1 , hoping that success there would make the pdf link problem go away; or that I'd be in a position to recompile phantomjs. But after 5 hours I'm lost - a ./autoconf batch file stops with a libglib-2 version insufficient message. I see dire warnings about trying to remove / reinstall this library (http://unix.stackexchange.com/a/49515), because of all the dependencies (all the latest official versions). So can anyone say which upcoming version of PhantomJS will adopt webkit 534.54 or greater?

Much appreciated!

@JamesMGreene
Copy link
Collaborator

Well, as far as I've been able to discern, the WebKit included in Qt 5.0.2 is from revision 136242, which was last changed on 2012-11-30 (just a few days before the Qt 5 release). That seems plenty current.

I'm not sure what the corresponding 5xx.xx version number is, though...?

@ariya
Copy link
Owner Author

ariya commented Jun 5, 2013

It's less of a problem with WebKit and more with the PDF generation. Replace WebKit with any document technology and the hyperlink will not exist if both sides do not agree to detect + produce it.

@ddooley
Copy link

ddooley commented Jun 5, 2013

I see now (from thread #10448) this would go away with Phantom 1.10 or certainly 2.0 because of adoption of Qt 5 . So some time in the fall/winter 2013 ?! Ok.

And certainly I appreciate that there's a lot of work in trying to keep PhantomJs up to date with fundamental changes in its underlying dependencies like qt/webkit !

Cheers,

@wachunga
Copy link

One thing I noticed: links are clickable in the PDF if the <a> tag has the same text as the href. So <a href="foo.com">foo.com</a> works, but not <a href="foo.com">Click here</a>.

Not ideal, to be sure. But might help someone.

This is as of phantom 1.9.0.

@wachunga
Copy link

Correction to my previous post: anchor tags don't help at all. It's just my PDF viewers that are making the url text clickable.

Acrobat and Chrome PDF viewer pick up anything with http(s):// and/or www. Preview also picks up bare urls like website.com.

So basically the hyperlinks aren't coming through from PhantomJS at all.

@AndrewEastwood
Copy link

:(

@apeiniger
Copy link

Any news on this?

@tanmaygarg
Copy link

Hey, is this issue fixed yet?

@szepczynski
Copy link

+1

2 similar comments
@apeiniger
Copy link

+1

@pofider
Copy link

pofider commented Aug 6, 2014

+1

@jobinsjohn
Copy link

Any update on the click feature on hyperlinks?

@thom4parisot
Copy link

I guess it will be part of PhantomJS 2.

@jobinsjohn
Copy link

@oncletom Well i have solved the problem to an extend. Its not a complete solution. But it serves my pupose for the time being. May be the solution will be there in PhantomJS 2.

astefanutti added a commit to astefanutti/phantomjs that referenced this issue Aug 5, 2015
Hyperlinks are written into the PDF engine during the paint outlines phase

ariya#10196
astefanutti added a commit to astefanutti/phantomjs that referenced this issue Aug 6, 2015
Hyperlinks are written into the PDF engine during the paint outlines phase

ariya#10196
astefanutti added a commit to astefanutti/phantomjs that referenced this issue Aug 6, 2015
Hyperlinks are written into the PDF engine during the paint outlines phase

ariya#10196
astefanutti added a commit to astefanutti/phantomjs that referenced this issue Aug 6, 2015
Hyperlinks are written into the PDF engine during the paint outlines phase

ariya#10196
@jhihn
Copy link

jhihn commented Sep 3, 2015

Note that the patch was included in Qt 5.6.0, which should be about in about 6 months.
https://bugreports.qt.io/browse/QTBUG-44563

@vitallium
Copy link
Collaborator

@jhihn I don't think we will ever migrate (upgrade) to Qt 5.6.0.

@danielbayley
Copy link

I don't think we will ever migrate (upgrade) to Qt 5.6.0.

Why not?!

@vitallium
Copy link
Collaborator

Because release Qt 5.5.0 was the latest release of QtWebkit.

@astefanutti
Copy link
Contributor

Qt WebKit has indeed been removed from the Qt release packages though it is still maintained and part of the Qt 5.6 release from the source code which is the way PhantomJS is integrating Qt WebKit in its code line. So unless there is an actionable plan to migrate to the new Qt WebEngine or any other underlying Web engine, it is still possible to upgrade to Qt 5.6 and benefit from that enhancement.

@vitallium
Copy link
Collaborator

@astefanutti keeping QtBase and QtWebkit out of sync might be dangerous.
We have future development plan, but we don't have people and resources.

wision pushed a commit to wision/phantomjs that referenced this issue Sep 16, 2015
Hyperlinks are written into the PDF engine during the paint outlines phase

ariya#10196
@JordanMajd
Copy link

+1

Hey guys, I know you have a lot of work on your plate but I'd love to see this patched.

@stgogm
Copy link

stgogm commented Nov 12, 2015

Currently, if you place your URLs, anchor or plain text, inside a <table>'s <td> element they will be clickable when opened in Chrome or Opera.

@astefanutti
Copy link
Contributor

Given the externalisation of Qt Base and Qt WebKit as submodules, PR #13250 is superseded by the two following PRs:

@astefanutti
Copy link
Contributor

As vitallium/qtbase#1 and vitallium/qtwebkit#1 have been merged and are now included in master branch, this can be labelled for next release and closed.

@vitallium
Copy link
Collaborator

Landed in master.

@alfchee
Copy link

alfchee commented Nov 18, 2016

@RomanMinkin I'm having PDF's with links working but I want to avoid what you did about to make:
<a href="http://domain.com">This is a link</a> some text
Looks like: This is a link (http://domain.com) some text

It is making akward some reports that I want to render in PDF.
capture 2016-11-04 at 20 28 41

@alfchee
Copy link

alfchee commented Nov 18, 2016

Ok, no problem, I found the answer in another issue of this project, alanshaw/markdown-pdf#63

I have solved my problem.

@RomanMinkin
Copy link

@alfchee sweet. I used css to display link that way.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.