Mattgyver

View Original

Making URLs in Illustrator behave like links in a PDF

Overview

Illustrator variables allow text URLs to behave like proper hyperlinks when saving the document as a PDF. It’s a useful trick to avoid assigning links afterward in Acrobat (painful) or needing to author your document with InDesign (fine… for multi-page publications). Illustrator can be touchy however, so I’ve gathered a few tips to help.

This Illustrator “trick” lies in Adobe Acrobat’s ability to create links from any URL it sees. This is a default setting, so unless a person has disabled it, all URLs created in Illustrator’s variables panel will be seen by Acrobat as a hyperlink.

June 2023 Update — The future is now! Adobe has (finally) added the capability to add links to text and images within Illustrator when saving the file as a PDF. Select the text you’d like to behave as a link, and in the Attributes panel choose Image Map: Rectangle (or Polygon) and enter a URL 🔥🌎🔥.

See this content in the original post

I mostly work on small docs; single page flyers, detailed invoices, illustrated data sheets, infographics, small brand guides, and so on. Adobe InDesign never enters my mind until I have a document requiring 12 pages or more. Illustrator is more than sufficient to create beautifully arranged short books. The trade off between Illustrator’s powerful tools (and multiple art boards) far outweighs the need to use InDesign’s industrial-strength publication layout capabilities. The ONLY reason InDesign saw any use around the office was for hyperlinks within the copy.

See this content in the original post

Adobe Acrobat is a last resort tool to edit a PDF and add hyperlinks on top of the content. This is typically fine if there’s only one or two links — perhaps a designer’s resumé where one might need to add a personal website link. The drawback is every time the PDF is authored/updated from Illustrator (or even Photoshop), it always requires the additional step of opening the file in Acrobat, adding links, and saving it again. After doing this once or twice you’ll realize any edits or content tweaks force one to repeat this tedious process each and every time.

adding URLs in Illustrator

Here’s a typical doc that would benefit from having links — it’s my extra spooky list of 13 fall beers found in Charlotte area grocery stores. Because it’s a PDF, each of the 13 brewery URLs should link to their actual websites.

Download the PDF

But rather than importing this into InDesign or Acrobat to generate the hyperlinks, we’ll add the URLs directly in Illustrator using the Variables panel (Window > Variables). Such a sad, empty panel. Always hungry for data, but never being fed.

The Variables panel. Waiting. Watching…

1. Create a new layer to hold all the URLs

Create a new layer in the Layers panel. It’s helpful to contain all the URLs on their own topmost layer to make hiding and manipulation easier (and avoid losing them). A little organization goes a long way.

2. Add individual text boxes for each URL

Place a text box containing the full URL on top of every intended link in the document (or on top of images, logos, etc.). Use the point type text box (not the paragraph type word wrapping text field). The URLs must be formatted correctly and completely (http:// etc.).

Stretch and squish the text box to fully cover the area you want as the link hot spot. I find it helpful to use a bright contrasting color to make these easier to find in the future; it doesn’t have to be pretty. The before and after looks like this:

Before adding URLs

After adding URL text boxes

3. Convert each link to a variable

Select the text boxes one at a time and click Make Text Dynamic in the Variables panel. It’s the little gear/block icon in the panel footer. A new variable will be added showing its object as the URL from the text box.

Click Make Text Dynamic to convert your URL to a new Variable Object

4. Hide the URL text

We’re basically finished, but before exporting as a PDF we want to make all the ugly URL text invisible; the hyperlinks will still work even when hidden. Click the layer target (the little circle next to the layer name) and head over to the Transparency panel and change the entire layer Opacity to 0%. This makes it easy to hide everything at once and avoids the need to hunt down individually hidden links should we need to make future adjustments.

Select the layer target

By setting the layer target transparency, all links are affected at once

Exporting as a PDF

There’s nothing special needed to save your doc as a PDF with hyperlinks intact. File > Save a Copy… > Format > Adobe PDF. Choose whichever options are needed. I typically use [High Quality Print] but anything will work.

Reviewing the PDF and common issues

Check your links by reviewing the PDF. Mouse over each link and make sure the URLs are correct. Acrobat usually needs a moment to recognize the URLs and generate the hyperlinks, but they should all become active hot spots shortly after opening the file.

See this content in the original post
  • It’s helpful to leave all the link text visible at first, export the PDF, check the links, then go back and hide the layer once satisfied for the final PDF.

  • Acrobat’s ability to create hyperlinks from urls can be found under General > Create links from URLs. It’s on by default, but can be turned off — though what kind of experience would Acrobat be with links disabled ¯\_ (ツ)_/¯ This is pretty much a them problem not a you problem.

  • As with all PDFs, clicking any links will display the usual Security Warning. This is normal for every PDF no matter how it was generated or how the links were added. It simply means “You’re about to go somewhere, ya sure?”

  • There is no way to create bookmarks within multi-page PDF docs, add file attachments, and other high-level Acrobat functions straight out of Illustrator.

  • The way PDFs export, sometimes the URL text can fracture into several pieces or wind up with missing characters (i.e. they no longer work). Sometimes exporting a PDF feels like letting a 4 year old make you a sandwich; where everything seems fine… until you eat crayons. It’s important to test every link and keep them as short possible. Too much distortion tends to ruin the URLs. In the following examples using the exact same URL text, the left hyperlink is fine (https://www.foothillsbrewing.com/), but the right hyperlink is missing an S, O, and L (http://www.fothilsbrewing.com/), which must be Illustrator’s hilarious way of telling me I’m “SOL” (Shit Outta Luck).

The link is still correct in Acrobat despite being huge: https://www.foothillsbrewing.com/

Acrobat decided this link didn’t need an S, O, and L; the link is incorrect: http://www.fothilsbrewing.com/

Wrapping Up

That’s all there is to it! Pretty spooky, no? For those of you who didn’t believe Illustrator could export URLs into a PDF as hyperlinks, I shun the non-believer. Though I don’t blame you because this solution is difficult to find. It’s such a tricky question to phrase correctly for quality search engine results. Anyway, I hope this helped.

If you’d like to see the setup and edits I used to create this beer photo, check out my Before and After: Magazine Beer Spot article.

Thanks for reading!