Internal links with wkhtmltopdf?
Asked Answered
P

3

19

I have created a PDF from several web pages using wkhtmltopdf.

Is there a way to link across pages, for example from page 10 to 15.

I tried creating an element with an ID and then an anchor to link to it, but this does not work within the same page or across pages. It turns the link into an absolute URL and tries to open it in a web browser.

Pawsner answered 29/2, 2012 at 20:40 Comment(4)
My pdf internal links works fine. I am using the name without path, Please show some code?Monaghan
ppant: How do you actually do the internal links in the HTML side? With anchoring like in the question using <a href="#Somewhere">Here</a>?Gaulish
Is this still an issue? Did you manage to fix it? @Monaghan How did you get them to work? For me the links are constructed like in my comment above and the print nicely, but they are not clickable in Acrobat Reader or in Foxit reader. I have 0.11.0.Gaulish
No longer an issue as of Oct '14Fritzsche
L
5

I solved this issue by updating the binary that I was using. I was using 0.8 and switched to 0.11.0 rc1.

Ensure that it is built against QT (the latest binary at http://code.google.com/p/wkhtmltopdf/downloads/detail?name=wkhtmltoimage-0.11.0_rc1-static-amd64.tar.bz2 is.

And then just to be sure enable internal links:

--enable-internal-links 

when you call the conversion

Lelandleler answered 23/8, 2012 at 8:42 Comment(1)
Just to clarify is anyone is wondering, the link is to wkhtmltoimage for 64bit linux. Search for the binary you need (PDF for the OP) for the OS you have.Gaulish
A
3

i had this issue after installing pathced version of QT

i had wkhtmltopdf 0.9.6, than i also switched to 0.11.0 rc1

then worked fine! and no need to use --enable-internal-links. you can just turn off this option by --disable-internal-links* by default its on.

Axolotl answered 21/9, 2012 at 10:6 Comment(0)
E
2

Internal links appear only to work correctly in certain builds for certain platforms. With the latest WkHTMLtoPDF 0.12.5 releases the unix builds are OK (at least for Centos and Ubuntu) and internal links are generated correctly BUT windows builds DO NOT work and leave broken links. I don't know why this is and have commented on GitHub accordingly. Also when multiple html input documents are used any 'internal' hyperlinks between these are broken (all platforms). In other words cross input document links are NOT fixed up. This would be a really useful feature addition (particularly when generating massive reports) but sadly does not appear to be supported as yet.

Eadie answered 9/4, 2019 at 12:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.