is now part of CreativePro.com!

Changing Layer Visibility in an Interactive PDF

28

I’ve posted a few times about creating interactive PDF files?particularly how to use InDesign’s powerful button feature for creating interactivity. First, I posted about how creating buttons got easier in InDesign CS4 (and CS5). Then, I posted about showing and hiding objects in interactive PDF. Finally, I added some other PDF button tips.

But today in the Adobe InDesign Forum, I came upon this question:

I have a series of buttons that reveal hidden graphics. One of those hidden graphics is a background layer, in a separate layer, that should appear when a button is clicked. It is showing up, but in front of all other content, even though the layer is in the background. I have nothing else on the background layer. Also, the preview in InDesign shows this working properly, it’s the exported Interactive PDF that is having problems. Any suggestions?

Show/hide buttons can let you show and hide objects which have themselves been turned into buttons. But, in InDesign, show/hide buttons cannot control the visibility of layers. I think it’s because of the way buttons are handled in a PDF file. They are treated as a separate “layer” above the “content” of the PDF file. (The Preview panel in InDesign CS5 is mostly accurate in previewing SWF output, not PDF, because it uses InDesign’s new Flash capabilities.)

However, you can change the layer visibility of a PDF file, you just can’t do it in InDesign alone. You also have to make use of the layer controls in Acrobat. So here’s a simple example which has three layers?a yellow background, text, and a graphic. We’d like to turn the background on and off with a button.

Three layers

Three layers

We’ll create the buttons in InDesign because it lets you turn virtually any artwork into a button. For my simple example, I’ll include a descriptive label “Background On” or “Background Off.” While it’s not required, we’ll put the objects which will become buttons on an Interactivity layer.

Interactivity Layer

Interactivity Layer

To turn each of them into a button, open the Buttons panel. Just select the object, and click Normal in the State Appearance section of the panel. (You could add a Rollover appearance, but we’ll keep this simple.) We won’t set an Action.

Create Button - No Action

Create Button - No Action

Since layer visibility isn’t a button Action we can set in InDesign, we’ll next export our document to create an interactive PDF file. How we do this depends on which version of InDesign you’re using. In InDesign CS4 and earlier, choose File > Export,  select Adobe PDF in the Format menu, and click Save. In the Export Adobe PDF dialog box, there are three things required:

  1. You must set Compatibility to Acrobat 6 or later (because PDF layers only became available in that version 6).
  2. You must check Create Acrobat Layers.
  3. You must check Interactive Elements (so the buttons will become part of the PDF file).

InDesign CS5 how has two different paths for creating PDF files?Print and Interactive. To include buttons in a file, we must choose File > Export, select Adobe PDF (Interactive) in the Format menu, and click Save. Then you’ll see the new dialog box below. All you have to select is Create Acrobat Layers, and accept the other defaults.

CS5 Interactivity Export

CS5 Interactivity Export

In Acrobat (you must have Acrobat 6 or later), open the Layers panel to view your layers. In Acrobat 9, choose View > Navigation Panes > Layers. In Acrobat X, choose View > Show/Hide > Navigation Panes > Layers. You’ll also need to make available the Select Object tool. In Acrobat 9, choose Tools > Advanced Editing > Select Object Tool. In Acrobat X, open up the Content section under Tools at the upper right. When you choose this tool, you’ll be able to work with the buttons you created in  InDesign. In the illustration below from Acrobat 9, I’ve circled the Layers panel and the Select Object tool. Notice the buttons are highlighted below.

Layers in Acrobat

Layers in Acrobat

The Layers panel works the same in Acrobat as it does in InDesign. You can click the eyes on and off to make layers visible. We want to use each button to control the visibility of the layers to make it easier for a viewer.

First turn all the layers on (the default) so the background is showing. Then select the Background On button with the Select Object tool. Double-click on the button to open the Button Properties dialog. Click on the Actions tab. In the Select Action menu, choose Set layer visibility. When you click Add, the Layer Visibility action will be defined, showing exactly the layers which are currently visible.

Set Layer Visibility

Set Layer Visibility

Now, turn off the Background Layer on the Layers panel, so the background is not visible. Select the Background Off button, and double-click. Repeat the same choices as before.

Background Off

Background Off

It would be a great addition to the next version of InDesign, to add layer visibility to InDesign’s button actions so you don’t have to do these extra steps in Acrobat!

Steve Werner is a trainer, consultant, and co-author (with David Blatner and Christopher Smith) of InDesign for QuarkXPress Users and Moving to InDesign. He has worked in the graphic arts industry for more than 20 years and was the training manager for ten years at Rapid Lasergraphics. He has taught computer graphics classes since 1988.
  • Wow, Steve, I actually never realized that setting layer visiblity was so easy in Acrobat. (For some reason I thought you needed a javascript to do it.) Thanks!

  • wkr says:

    Nice!
    Thanks?

  • Ivan Berka says:

    Wow, thanks for bringing me into new dimension of publishing!

  • Kelly Vaughn says:

    People interested in Show/Hide Layers might also be interested in a script that PreMedia Systems put together a few years back. It’s called Sandee Cohen’s Show/Hide Buttons script. It shows and hides individual objects as opposed to entire layers.

    If you need to create rollover effects, this is a great tool to simplify the process. Let’s say you you mouse over one object (for example, a camera icon), then another object is shown (like a photo). And then when you mouse away, the photo is hidden again.

    And it’s free (with the encouragement of a paypal donation).

  • Bethanyker says:

    Thanks, this is very helpful. However, I am creating a teacher’s answer key for student workbook pages. I want to toggle on/off the layer with the correct student answers. I would like to accomplish the toggle on/off with one button, instead of having two buttons (one for answers on, and one for answers off). Do you have any suggestions?

  • @Bethankyer: You might consider using a plugin like Layer Comps from DTPtools.com.

    The BlatnerTools suite of plug-ins also allows keyboard shortcuts for show and hide layers, which might be helpful.

  • The Craw says:

    I am having a problem that I don’t know how to work around.

    I have several buttons in my document. One pops up additional info from an embedded PDF, and one displays a video, on a layer that sits above the text flow and buttons.

    I do this because I use the movie layer to dim the background, and present the movie in a frame. (This is a familiar user interface mechanism to most people).

    My problem….if I use buttons to turn the visibility of the movie layer on and off, the buttons still float on top of my dimmed layer. This completely breaks the “dimming” because all the active buttons in the text flow stillfloat on top.

    Is the ANY way to make a button NOT float above all other layers?

    many thanks!

  • François Delfosse says:

    Tanks for all the helpful comments!

    Is it possible to integrate the “Layers” panel within the pdf by converting it into buttons?

  • Clare says:

    I have a similar issue. I have created an interactive indesign doc to be exported to PDF. When I place movies into the PDF file they initially work great- the nav falls above the movies and looks perfect. However as soon as the movie has been activated the buttons in the nav fall behind the movie and are no longer visible. Do you know any work around for this- is there some thing I am missing along the way to keep the movie on the bottom layer?

  • @Clare: You need to make sure the navigation buttons are real buttons in InDesign’s buttons panel. Only buttons (interactive objects) can sit on top of other interactive objects. When I export to PDF (Interactive) from CS5.5 it works for me.

  • Annie says:

    This may seem silly, but I’ve completed all of these steps…how do I finalize the PDF?

  • Annie says:

    Also what if I have a couple buttons and I want them to cross and show various options?? I have a PDF example, please let me know how I can share this.

  • Donald says:

    This worked great, thank you for your help. One issue I have found is if you change the layers to a different state as the default state (e.g. you open the file and change some of the layers visibility), when you save the file and reopen it, the layers state is back to the default state and not the state that you save the file.

    Is there any way you can save the state of the changed visible layers?

    Thanks

  • Dario says:

    HELLO! Great tutorial :)
    Do you know if there is a way to batch change pdf layers’ properties (print it, view it, …) inside Acrobat?

  • Steve says:

    I have two interactive PDF’s created for use on an iPad. I’ve put a box across the top of the page to be able to double tap and it will zoom to the top of the page. Only on one of the PDF’s it doesn’t work. Every other document I have created it works just fine. You can zoom in on pictures and text or any box that has a color in it, even if that color is transparent. But, I think it’s a setting on the one I’m having a problem with as the picture don’t seem to want to zoom either, but I can get it to zoom in on text. Any help would be appreciated. Thanks

  • More options availableSome online universities offer you three options:
    you can attend live streaming of lectures and join the discussion or make
    an appointment with glasgow divorce lawyers the solicitors that
    you’re considering. This’ll ensure that personal injury lawyers or an experienced California brain injury lawyers.
    Firstly, one has to look into a law school, you learn how to get there and what paperwork is required.
    Often times you may be entitled to compensation winning
    rewards through the courts.

  • Tim says:

    Is it possible to hide layers until a “password” is entered in a field in the pdf file?

  • Good morning,

    Is it possible to hide layers or even an image on a page inside a pdf file, until a “password” is entered in a field in the same page?

    I have plans to develop three projects using this features:

    – Instructional manuals with images and answers hidden, where students need to solve questions to be able to see them.

    – To produce cultural sticker albuns to distribute freely among the students with images and information already in place on the pages, but hidden, that will be revealed by the interaction with the text.

    – Creating deductive challenges that reveals the clues and images as people interact with the information.

    Thanks for your attention!!

  • marc says:

    Hello
    actually it works well. By cons I have a problem. I have a page that I created in InDesign with layers. this page once exported to PDF with layers it becomes an acrobat model. on another page I have a button to bring up this page (model). the appearance of the page is done correctly against it lost all layers. There are altogether removed.
    I know if you have ever had this case and if you have a solution?
    Thank you
    marc

  • Evans Joey says:

    I’m using CS5 to generate an interactive pdf, setting up text buttons to navigate to the network of text anchors I created, and have encountered the same problem. The buttons no longer advance to certain text anchors in the exported pdf and there appears to be no rhyme or reason as to why. Some work, some don’t. Some that used to work, stop working. Very frustrating.

  • Alison says:

    I’m trying to show and hide 2 layers that correspond with Yes / No radio buttons in Acrobat. I’m having trouble when setting the layer visibility back to Edit Form mode doesn’t carry over. I’m not sure what’s going on, has anyone else had that problem with radio buttons specifically? It works perfectly with normal check boxes….

    Thanks

  • What’s up to every single one, it’s in fact a pleasant for me to pay a quick visit this web page, it
    contains priceless Information.

  • Heidi Wormser says:

    Great tutorial! I didn’t know that it was possible to show and hide layers. I have a problem, however. I’m creating a pdf with several popups. Clicking a button on the base layer makes one of the popup layers visible. On that popup layer is a “close” button that I want to use to hide the popup layer. But since the “close” button is on the layer that I’m trying to hide, there doesn’t seem to be any way to set the layer visibility. If I hide the layer, I can’t access the button. Any ideas as to how to do this?

  • kmc says:

    I have multiple pages. I want to put 2 buttons on their master page and use them to show / hide globally. It seems I have to define the button actions for each page in Acrobat once I export to PDF, which is tedious. Can Acrobat honor something like a “global” button?

  • Pat redman says:

    My colleagues were wanting VA 9 earlier this week and came across an online service that hosts an online forms library . If you need to fill out VA 9 too , here’s https://goo.gl/CO92rg

  • Stephen Bench-Capon says:

    This works great but I have a slight irritation in that if I have to make even a little correction in the inDesign file and then export the PDF again, then I obviously have to redo all of the button/layer settings in Acrobat. I don’t suppose there’s any solution to this?

    At the moment I’m tending towards just using buttons in inDesign (instead of layers) so that at least I don’t have to redo them every time. But the layers would be much nicer in theory.

  • Disappointed says:

    Yeah, but here’s the thing…how do you publish it to the web and preserve interactivity. I’ve had to tell people to save the map to their desktop and use the hand tool in adobe to show my pop-up layers. I was hoping I could make the interactive work after I published it to the web. The interactive layers I created in InDesign worked. They button tool in Adobe –worked GREAT. Now, however, the pdf loses it’s interactive functions UNLESS someone downloads it. The hover over and show won’t work online.

  • >