2

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

Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
asked Jul 2, 2018 at 14:07

2 Answers 2

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.

answered Aug 11, 2020 at 22:22
0

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()

enter image description here

answered Jul 2, 2018 at 17:19
2
  • 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. Commented Jul 2, 2018 at 18:44
  • Ups, sorry, now i read slowly your question and i see that I been confused. Commented Jul 2, 2018 at 21:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.