PDF in story - when clicked open to certain page in doc

Feb 13, 2013

Hey folks,

I have a PDF file in my story (not in the resources tab but in a slide). I would like it when the learner clicks the image of the PDF document, it opens the PDF to a certain page. Is that possible? If so, can someone help me!

Thanks

...Z

3 Replies
Steve Flowers

Hi, Zdravko - 

PDF's can go to a specific page if the page is specified in the querystring. To get the page into the querystring you'll probably need to use some JavaScript. Here is one way to do that:

1) Create a number variable. If you're only wanting to open to a specific page one time you can skip this step

2) Use a JavaScript trigger to open the PDF in a new window with your page value.

var player=GetPlayer();

var pageref=player.GetVar("guideLink");

window.open('story_content/external_files/YourPDF.pdf#page='+pageref, '_blank');

In the script above, I'm referring to a file that I included in the resources tab. This bundles the file with my story even if the resources tab is hidden. I am triggering the JavaScript trigger whenever the page reference changes, under the condition that the pageref is blank.

If you're opening a PDF at a link and only want to reference the function once:

window.open('http://yoururl/YourPDF.pdf#page=4', '_blank');

If you're trying to open it in a Web object within the page, there's a little different approach. Still takes JavaScript. I'll dig for my example of that working. 

This discussion is closed. You can start a new discussion or contact Articulate Support.