I am attempting to add text labels in the composer that will result in clickable relative hyperlinks in the PDF output.
Adding a text label, ticking "Render as HTML" and adding www.google.com results in a clickable hyperlink from the PDF to Google. However, I'm struggling to generate a clickable relative hyperlink in the PDF. I'm aware the format of a relative path needs to use \
rather than /
. I've even attempted to wrap it in the following HTML code: Link but does not help.
How do I create a clickable relative hyperlink in the PDF output please?
Two related questions are: Clickable HTML link in QGIS print composer pdf export?
Creating Mapbook with Hyperlink texts in PDF using QGIS Atlas?
I've tried this in QGIS 3.0.3
2 Answers 2
Not possible, unfortunately. PDF definitely supports relative links but there is a known issue in QGIS which prevents HTML links in general from performing as expected.
The issue is marked as "won't fix" because it is inherited from the QT library rather than a problem with QGIS itself.
As a workaround, your best bet is probably to use a separate PDF editor to add links manually once the document has been exported. If you need to handle a large number of maps/pages with links based on attributes, consider an InDesign-based workflow with a data merge to automatically add links to each page.
You should to use variable @project_folder in expresion for action.
Type=Python
Action text=
from PyQt4.QtCore import QUrl;
from PyQt4.QtWebKit import QWebView;
myWV = QWebView(None);
myWV.load(QUrl("file:///[% @project_folder || '/' || "link" %]"));
myWV.show()
-
I'm unsure how adding this action will result in a composer text label that is a clickable relative hyperlink in the PDF output. However, I'm intrigued by your answer. Am I right in thinking that a layer feature could be a clickable hyperlink in the PDF output? This would actually be my preferred method but I didn't this this was possible.ASHHart– ASHHart2018年07月02日 18:44:16 +00:00Commented Jul 2, 2018 at 18:44
-
Ups, sorry, now i read slowly your question and i see that I been confused.Carlos López Quintanilla– Carlos López Quintanilla2018年07月02日 21:48:29 +00:00Commented Jul 2, 2018 at 21:48
Explore related questions
See similar questions with these tags.