Internal links with wkhtmltopdf?

那年仲夏 提交于 2020-01-01 08:12:12

问题


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.


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/9506276/internal-links-with-wkhtmltopdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!