Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Bringing Animation from InDesign CS5 into a PDF… with the help of a little script

Recently during the InDesign Secrets Print and ePublishing Conference, there was a fun event called Ignite InDesign where attendees to the conference (including a few of the speakers) gave 5 minute presentations with a slide automatically progressing every 15 seconds. Auto-advancing slides can be quite entertaining for the crowd when the presenter loses track of time and forgets which slide they are on. To create these presentations you could use PowerPoint or Keynote, but this is InDesign Secrets that we are talking about here and we want to use our favorite program.

CS5 has a lot of interactive tools are a lot of fun to use (as seen in Mike’s earlier post), and I wanted to use them in my presentation. My presentation was called “My Favorite Podcasts” and each slide mentioned the name of a Podcast, the album art and a few bullet points about the show. Rather that have normal static presentation, I used the new interactive tools to really have fun with the presentation. After experimenting I was able to successfully export it to SWF, but there was a problem. A SWF will not auto-flip (per the rules of the presentation) without some ActionScript code in Flash Professional and I don’t want to learn ActionScript.


Click the image above to watch the SWF

Using a PDF

A simpler solution was to export to PDF and just run the presentation full screen in Acrobat Pro/Reader. As simple as an approach like this might seem, it didn’t work like I thought. When you export your working InDesign file to a PDF the animations to not work. You are stuck with whatever is static on screen and the results are not very desirable.

The Manual Solution

In order to get the SWFs to play in your PDF you have to export each individual page out as a single SWF and then place it back into InDesign. I highly recommend that you place them on their own SWF layer. After the SWF’s are placed back in the layout you just have to turn the original design layers off and keep the SWF layer on. Now you can export your presentation to PDF and view the animations. If you need to make any changes to the presentation just turn your design layer back on, make your edits and export a new SWF of that page and replace the existing SWF. Your links panel will list a modified link, just update the link and export a new PDF.

Note: Placed SWF’s will not scale inside the PDF therefore it is important to design your layout at the final output size for your presentation.

Scripting to the Rescue!

Exporting each page of a 20 page presentation one at a time to a SWF and then manually placing each SWF back into the layout on its own layer is not fun. I did it for 20 pages just to get it done, but what if my presentation was 50 or 100 pages? I thought that scripting seemed like a perfect solution.

During the Conference I had to chance to meet the brilliant Martinho da Gloria from automatication.com who wrote the amazing Layout Zone script. I talked to him about the problem of manually exporting each page to an individual SWF and then placing them back into the layout on a new layer. He agreed that scripting was a viable solution and was quickly absorbed in the problem. A few hours later he had finished his SWF Presenter script which automatically exports each page to a swf and places them back into your layout on a new layer.

When you first run the script it will ask you where you would like to save all of the exported SWFs. I generally make a SWF folder inside my links folder for them. Next, the script will then prompt you with the SWF export options. When you click OK the script will batch export each page of the layout to and then place them back into the layout on their respective page. Now you can turn off the original design layer and export your layout with the placed SWFs to PDF. Update: After the script places the SWF on each page, each SWF is set to play on page load.

Downloads

The SWFpresenter script can be downloaded here.*
*updated to version 1.01

In case you are interested in all of the podcasts that I mentioned in my presentation you can download a PDF of them here.

James Fritz
James graduated with a Bachelor of Fine Arts in Graphic Design from the University of Wisconsin - Milwaukee in 2003. After a short stint designing catalogs he started working as a freelance designer for C2 Graphics Productivity Solutions. Soon he was promoted to a full time instructor/designer and subsequently become an Adobe Certified Instructor Design Master. Currently James is the Director of Content, Creative at lynda.com where he is also an author.
James Fritz

Latest posts by James Fritz (see all)

Tags
Related Articles
Comments

97 Comments on “Bringing Animation from InDesign CS5 into a PDF… with the help of a little script

  1. @Mitch,

    InDesign Secrets is not a paid site. What makes you think that it is? We offer a free subscription service which lets you receive a newsletter and post in our forums, but I am not aware of a paid service.

  2. James,

    If you Log Out, and try to view this post, you’ll get the message that this posting requires a paid subscription! I’ve never seen that before. Try it.

  3. The post is now fixed and everyone should be able to see it. Somehow in the posting setup options there was an option to restrict posts which must have been checked by accident.

    I apologize for the inconvenience.

  4. Glad it was nothing more serious. I’ve been reading the site since CS2 and was surprised by the message. I was concerned it might be an offsite hack. Happy it was just an errant check box.

  5. There is so much valuable information here, there are people taking time to test scripts and features and write articles, that even if I had to pay a little fee I would gladly do it because this little fee helps me save thousands of money.

  6. So they knew that animations couldn’t be brought to pdfs, but it only took someone a couple of hours to write a script to do it.

  7. Hi,

    Thanks to Martinho for this script.

    I am in the middle of creating a Presentation using InDesign CS5 and have already come across the limitations described and have been doing the manual exporting each page as a SWF and placing back in again.

    However, the script does not apply the “Play on Page Load” setting found in the new Media panel and also assigns the Standard Poster artwork when placing the SWFs back into the document.

    This means that I have to click on the Flash icon to activate the animation on each page of the PDF.

    I cannot seem to set a default as all settings in the Media panel are inactive without some Media selected.

    Unless I am missing something in either InDesign or Acrobat.

    Still a useful script though and will save a lot of time.

    Thanks,
    Simon

  8. @Simon,

    Great suggestion “Play on Page Load” for the placed SWFs. I will pass on this improvement to him.

    Regarding the poster artwork, why do you need to set a different poster for the SWF if you are having it play on page load? I would only want to have a poster if the animation was not going to happen immediately.

  9. I’m with Branislav. The information from this site has saved me so much time, head scratching, and frustration.

  10. Have been investigating interactive pdf’s for awhile now there are some great site on rich media content but its seems to be a small community and they keep their secrets quite close. I was hoping to use swf as button links in pdf although possible its is quite complex you need As3 and javascripting capabilities. One of the problems with swf in a pdf is they do not print ( again solvable with AS3)

    My work around is to make the presentation in IDCS5 export to Flash make simple but interactive swf one file.
    Go back to inDesign make a simple title page export the whole document with the title page, to a normal screen res pdf import the swf to the first page. set document to open in full screen mode with no navigation.

    whole presentation is on page one but if you print the pdf all the subsequent pages print looks to all intent and purposes the the interactive document has printed.

    Not perfect but with limited flash skills you can make impressive presentations without being a coder.

  11. @Graemezee,

    Regarding your printing question. If you design your presentation in ID with the original design on 1 layer and the placed SWF on the other, when you export your PDF to an interactive PDF be sure to include acrobat layers.

    When you have the PDF open you can run the presentation with the design layer off and the SWF layer on. If you have to print it, turn the SWF layer off and the design layer back on.

  12. @Fritz

    I was thinking about end users wanting to print the pdf. Many of my clients use interactive pdf’s, instead of brochures, they want the interactivity and the ability for their clients to print the document. swf files in pdf do not print and to explain to a clients client how to switch layers on and off in acrobat reader is a non starter. I know you can do much with swf AS3 and javascripting but in my limited experience it requires lots of skill and troubleshooting for limited gains. My original post seem to make more sense
    infinitely more interactivity, defined only by your skill in Flash. and a printable pdf Obviously the content generated in IDCS5 can be printed digitally or commercially dependent on the requirement

  13. @Graemezee,

    I see what you mean with it being complicated for the end users. Another simple solution would be to just export 2 PDFs from InDesign.

    1. The presentation PDF with the SWF animations
    2. The original design ready for printing

    Now it is dead simple for your client. They just choose which PDF that they want to use.

  14. Isn’t it possible to make one thing visible in the PDF but not print, and then the other thing not visible but does print.

    So in this case, can you make the SWF visible in the PDF but not printable. But under that have the original design not visible, but set to print?

  15. @Simon,

    The script was just updated to version 1.01 with the the placed SWF’s now set to on page load per your suggestion.

    Thanks again for your help!

  16. Thanks to Matinho.

    I should now be able to get my Presentation finished just before my 30 day trial ends.

    It has been fun creating animations and I have even had some nods of approval from the Flash users in the department.

    Hopefully I can impress the bosses enough for them to pay for the upgrade.

    Simon.

  17. @Fritz — something that might be even simpler for the end user rather than two separate PDFs… Combine the two PDFs into a single PDF Portfolio. User receives a single PDF file. When they open it, they are presented with two thumbnails, one for the “print” experience and one for the “interactive” experience.

    For those of you who haven’t seen PDF Portfolios yet, check out the samples here:

    http://www.adobe.com/products/acrobat/pdf_showcase/

  18. @James

    I think them receiving 1 pdf would be better for the end user. I’ve set up PDFs with printing and non-printing objects before, it’s really simple, but I haven’t done it with animations and swfs etc. but thought it might help.

    Well it’s an option anyway.

  19. @Michael – That is a great solution

    @Eugene – I do agree that everything should be as simple as possible for the end user, but I think Michael’s point of a PDF portfolio would be a great solution too. That is not to say that your idea is not either:)

  20. @James

    I think them receiving 1 pdf would be better for the end user. I’ve set up PDFs with printing and non-printing objects before, it’s really simple, but I haven’t done it with animations and swfs etc. but thought it might help.

    Well it’s an option anyway.

  21. I make interactive PDFs on a regular basis using InDesign – does anyone know if there is a browser capability (maybe a javascript or Flash solution) that would let me stream a website real-time into a PDF? If something like this could be done from within CS5 – that would be simple maaaahvelous!

  22. @ PublishMarket –

    CS5 will let you place a video from a URL. I have not tired it with streaming content, but it is an interesting idea.

    Here is the text from the help system explaining how to place a video from the URL.

    Place a video file from a URL

    Place a video file from a valid URL to play the streaming video in the exported PDF or SWF file. The video must be a valid Flash Video file (FLV or F4V) or H.264-encoded file (such as MP4).

    1. Select an empty frame or a video object containing a video you want to replace.
    2. Choose Video From URL from the Media panel menu.
    3. Specify the URL and click OK.

  23. thank you, thank you, thank you for that script!

    I have a 100+ pages presentation and the single page exporting was starting to break my spirit.

    FYI, The SWF file not scaling to page is supposedly fixed with Adobe InDesign CS5 7.0.2 update.

    Haven’t tested it yet but its listed as one of the fixes.

  24. Awesome, great script and I love this site!

    But can I suggest something? I set up a document that consists of 2 spreads (comprising 4 pages). I want the spreads to stay together. To achieve this I used the method where you tell ID to start at page 2.

    When I used this script, everything worked fine ? except! ? it exported 2 page ones, and left off the 4th page. I assume this is because my document is technically set up as pages 2-5, instead of the typical 1-4. Is there a way for the script to start at page +1, instead of looking for a page with absolute numbering of page 1?

  25. I’ve been using the technique of placing an image in ID5, applying animation, exporting as .swf and then re-importing the .swf before exporting the entire document to PDF. This gives me the desired PDF with animation. The problem is that the resulting PDF has a white frame enclosing the .swf – and the graphic within is reduced in size to accommodate the white frame. Anyone have an idea where I’m going wrong?

  26. Sage,

    This is a known bug. You need to open the PDF with the white background in Acrobat Pro and select the SWF with the select object tool. Next, right click and go to properties. In the properties, turn on transparent background. Personally, I think this is a bug, and hopefully this gets fixed in a dot release, but for now you will have to use this workaround.

  27. In Indesign CS5 I’m trying to place a video from a URL but I keep getting a invalid URL error. Is there a trick to this. My web master can figure this out either. I need to export a swf file magazine this week!

  28. @Christina: As Fritz said, it needs to be an actual movie. You can’t point it to a youtube or vimeo movie, for example, because those services don’t give you the actual URL for the movie itself.

    BTW, for general non-post-related questions like this, I suggest clicking the Forum button at the top of the page and starting a new thread.

  29. Thanks for the script it works great! But i still have a problem.

    When i export my interactive pdf, my rollover buttons will not work and they wont activate videos they are connected to. My animations work fine but not buttons and video.

    If i export the pdf normally the video and rollovers work but no animation hence the need for the script. :)

    The swf files that the script makes work fine.

    I am wondering if the script needs to be altered.

    Thanks for any help you can give.

    Cheers!

  30. @Marcel – If your video was legacy video (.mov or .avi) it will not work when it is involved with SWFs. If you have legacy video you can convert it with the adobe media encoder.

  31. Yes i have the video brought in as FLV from the encoder.

    When i manually export the swf files and import them back before i export as a PDF the file works fine, but when i use the script, the rollovers and animations work fine but the flv videos do not play.

    I am also using CS5 and i did a update yesterday just in case it might have been that.

    Thanks for your help!!

    marcel

  32. Hi
    Has something changed recently, as I did have my next and previous page buttons working ok, but now they are broke!

    I have them set as buttons with the ‘go to next or previous page’ command on them, I’m then using the SWF Presenter script and exporting as an interactive pdf ? and now they’re broke.

    I think its something to do with the exported swf as I have some from a month ago that work fine, with the same commands set.

    Can anyone else confirm? I’m running 7.0.3 on a mac

    thanks

  33. I thought this script was the answer to my prayers and it does everything you said it does – so I end up with an additonal SWF layer after i’ve run the script.

    … but, i’m creating a presentation with a strange page size – to fit a widescreen (1600 x 960) presenetation screen. The problem I have is in the final pdf the animated slide is not full size on the page (its about 65%). To check something wrong is happening, I pdf the page with the placed swf provided by the script and another page with the placed swf removed. The page with the swf removed comes out the correct size and the placed swf is about 65% size in the middle of the sheet?!

    Its so strange and I can’t work out what on earth is going wrong. Is the script specific to a certain page size or am i doing something wrong when I run the script – i’ve tripple checked i’m selecting 100%.
    eek heelp – thanks

  34. If I pdf the document as a ‘Print’ pdf, the animated slide appears as the correct size. If I create an ‘Interactive’ pdf it resizes the content.

    If i set the poster in the Media panel to ‘From Current Frame’ the swf appears the wrong size. So its definitely in the final pdf stage i’m having a problem. I’ve tried every setting to see if it makes a difference but it always comes out wrong. Again, any help would be hugely appreciated.
    thanks

  35. @treehuggergraeme

    I have not tried the script with multiple page sizes, but I have had problems in the past with SWF files that did not scale properly. I would recommend that you create your presentation at 100% of its actual size to avoid the problems that you have been having.

  36. If you open the media panel (window > interactive > media panel) and open the the panel menu you will see an option called “video from URL”.

    If you read the help system, it will go into much more detail. I also talked about this in more detail in my lynda.com series InDesign CS5: Interactive Documents and Presentations.

  37. How do I get a Targus presentation remote to work with an Indesign SWF?

    I’m wondering if anyone knows the secret to getting a presentation remote to work with an Indesign generated SWF file in Adobe flashplayer? It’s able to work in Flashplayer using a flash file that I generated from prezi.com.
    Do you guys know of any actionscripts or other secrets I can use?
    Thanks, Brett

  38. @BrettFawcett

    I am not really sure how to get a presentation remote to work with a SWF since I have never tried to use one. The problem is that SWFs generally rely on you to click a button to advance to a page. I don’t know if it is possible to map a button that created in a SWF to a remote.

    As to why a different SWF works, I really don’t know.

    If you do figure out a workaround, please come back here and give us an update!

  39. This post has been very useful as it is exactly what I am trying to do but I cannot get the script to work. When I run it, I am asked to select a language. It does not seem to matter what I select as it always just looks like random letters. What am I doing wrong

Leave a Reply

Your email address will not be published. Required fields are marked *