In Flare 8, how do I configure a "blank", inactive button that I've added to an HTML5 help system's toolbar to enable the user to download a PDF file?
I've been able to use the HTML 5 Skin Editor to add a "blank" button to the toolbar. Presumably I now need to use JavaScript to connect that placeholder button to an image file of some sort AND provide some script-driven download as PDF operation(?)
In pursuit of learning how to do that, I went the Flare 8 online help system as follows:
http://webhelp.madcapsoftware.com/flare ... Output.htm
That topic explains how I can add a button, then associate JavaScript with that button. Here's where I'm stuck.
I've searched this forum for "HTML5 button JavaScript" and variants thereof, but have so far come up empty. I suspect somebody must have asked this question before me, but I haven't been able to find any forum threads.
I've also tried a few online searches for "JavaScript download file". What I've found seem to me to be rather large and complex scripts(?)
So, can someone please point me to a good source of JavaScript information for use with Flare buttons? (I'm happy to read and learn from trustworthy information, I just don't want to over-implement the JavaScript functionality.)
Alternatively, can somebody please share their working "download as PDF" JavaScript with me?
------
Small Update: After I asked this question here another correspondent told me the problem had to be solved with a server-side script. If true, that's wayyyyy more complicated than I want it to be…
Cheers & thanks for your help,
Riley
SFO
HTML5 toolbar button: JavaScript to download a PDF file?
-
Phlawm53
- Sr. Propeller Head
- Posts: 442
- Joined: Tue Mar 16, 2010 10:58 am
- Location: San Francisco, CA
- Contact:
ANS: HTML5 toolbar button: JavaScript to download a PDF file
Okay, I got something to work well enough for the time being.
In HTML5 Skin Editor -> Styles -> Toolbar Button -> Event -> Click, I pasted the following:
It opens a new browser tab and starts the file download.
The browser behavior is a bit less interactive than I'd like, but otherwise it essentially works. If I find more dynamic solutions I'll update this thread with them...
Cheers & hope this helps,
Riley
SFO
In HTML5 Skin Editor -> Styles -> Toolbar Button -> Event -> Click, I pasted the following:
Code: Select all
window.open("http://[Full Path to PDF File]");The browser behavior is a bit less interactive than I'd like, but otherwise it essentially works. If I find more dynamic solutions I'll update this thread with them...
Cheers & hope this helps,
Riley
SFO
Last edited by Phlawm53 on Tue May 10, 2016 9:59 am, edited 2 times in total.
-
Thomas Tregner
- Propeller Head
- Posts: 56
- Joined: Mon Apr 05, 2010 6:51 pm
- Location: Charleston
- Contact:
Re: HTML5 toolbar button: JavaScript to download a PDF file?
If you don't want a button, you can also insert links with JavaScript. You could handle styling with JavaScript manipulation or with a stylesheet. This will just add a 'div' containing an 'a' hyperlink to the left button container.
Code: Select all
function linksLoad()
{
var links = document.createElement('div');
var exampleLink = document.createElement('a');
exampleLink.setAttribute('href','https://www.example.com');
exampleLink.innerHTML = 'Example';
links.appendChild(exampleLink);
document.getElementsByClassName("button-group-container-left")[0].appendChild(links)
}
linksLoad()-
salipour105
- Jr. Propeller Head
- Posts: 2
- Joined: Fri Sep 04, 2015 1:15 pm
Re: HTML5 toolbar button: JavaScript to download a PDF file?
Here is javascript that I have used for the HTML5 "PDF" toolbar button:
window.open('#PDF/doc.pdf', '_self')
Where:
doc.pdf = the name of your generated PDF file
#PDF = the PDF directory
This requires the following:
[*]A "PDF" sub-folder to be created in the Content directory.
[*]A project Destination to publish the PDF to the Content directory
Before generating the online help, first generate and publish the PDF. The PDF file will open in the online help window, not in a separate tab.
window.open('#PDF/doc.pdf', '_self')
Where:
doc.pdf = the name of your generated PDF file
#PDF = the PDF directory
This requires the following:
[*]A "PDF" sub-folder to be created in the Content directory.
[*]A project Destination to publish the PDF to the Content directory
Before generating the online help, first generate and publish the PDF. The PDF file will open in the online help window, not in a separate tab.
