I'm using QGIS 2.8.1 Atlas and creating a mapbook using a grid layer that has an attribute with a URL in it.

I want to use the URL in the attribute to be a hyperlink in the PDF once its published.

Is there just an expression I can use to do this?


In QGIS 3 (and possibly in your version) you can add an HTML box (Top menu: Add Item > Add HTML) where you can add a hyperlink. If your grid layer is being used as a coverage layer, adding the URL should be simple: you can use the expression [% "name-of-your-url-attribute" %] to pull in the link.

In your HTML Frame properties window, your code would look something like this:

<a href="[% "name-of-your-url-attribute" %]">[% "link-title" %]</a>

Unfortunately, QGIS doesn't seem to handle exporting hyperlinks in PDF for now. So even if you manage to create those links in the layout, the link will not be active.

Related question: Clickable HTML link in QGIS print composer pdf export?

QGIS bug tracker issue.

EDIT: Here's a Python code snippet for creating a PDF mapbook from QGIS Atlas images by adding links to neighbor tiles on each page.

I used this script to add links to images generated from a QGIS atlas and read them on my e-reader as a PDF. It works just fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.