I am trying to create buttons that link to specific pages on a pdf that is connected to a separate button. My goal is to have to do as little as possible when the primary button (with the pdf) gets updated.
I have been trying to use a variety of methods but I settled on concat and it seemed to have worked but, in updating the pdf, it stopped working.
Does anyone know how to get this to work?
I have included the code here:
$w.onReady(function () {
let book = $w("#TrusteeFacebook").link;
$w("#Terry").link = book.concat("#page=21");
$w("#Terry").target = "_blank";
$w("#Laurie").link = book.concat("#page=10");
$w("#Laurie").target = "_blank";
// there are more but you get it
$w("#Susan").link = book.concat("#page=38");
$w("#Susan").target = "_blank";
$w("#Candace").link = book.concat("#page=39");
$w("#Candace").target = "_blank";
});
I need the link to show up in the search bar as book#page=21
where book is the base url for the document
At the moment the document just opens to the page it was last on when opened. It doesn’t matter what is in the code if I scrolled to page 7 and then clicked on the #Terry button, it would open to page 7
What ‘search bar’? I don’t see any search bar in your code. Please explain.
Anyway my code is for button link with reference to a specific page in a pdf file.
For anyone who finds this at a later date, the code I found that works is as follows:
$w.onReady(function () {
let pagemodifier = String.raw`#page=`;
//the special apostrophes (`) tell the code that the inclosed text should be treated as just text(since # is a predefined thing in javascript)
let directorypdf = "insert your url here";
//url for pdf you have in your media folder (must be
url, not document)
$w('#Directory').link = directorypdf;
//#Directory is a button that takes you to the first page of the document
$w('#Terry').link = directorypdf + pagemodifier + "21";
$w("#Terry").target = "_blank";
//as many items as you want
$w("#Candace").link = directorypdf + pagemodifier + "39";
$w("#Candace").target = "_blank";
});
//*note: the objects are all buttons, this is how you can do a customized hyperlink kind of situation. You cannot link a section of text within a text box unless it is the entire contents