Page 1 of 1
Opening PDFs
Posted: Wed Aug 22, 2012 1:04 pm
by rmullis
I have several PDFs that I want to place in folder /www/profoundui/htdocs/profoundui/userdata/custom and open when the user clicks on an icon or button on the webpage. So far, I haven't been able to get this to work. Is this possible in ProfoundUI? And if so, what is the proper format and/or PUI API to use to accomplish this?
Re: Opening PDFs
Posted: Wed Aug 22, 2012 1:22 pm
by Scott Klement
The /www/profoundui/htdocs directory is your Apache DocumentRoot. So any PDF documents in profoundui/userdata/custom should be directly accessible to the browser by opening a URL.
For example:
http://YOUR-SYSTEM:8080/profoundui/user ... R_FILE.pdf
With that in mind, you could code a hyperlink that points to that location, or you could add some JavaScript code that runs on an event. Either one should be able to open the PDF.
Does that help?
Re: Opening PDFs
Posted: Wed Aug 22, 2012 1:45 pm
by rmullis
That almost helps Scott.
How would I get the URL for a system dynamically? This particular application will be running on multiple systems for our customers, each with a different IP address/URL.
Re: Opening PDFs
Posted: Wed Aug 22, 2012 1:52 pm
by Scott Klement
You'd use what's known as a "relative" URL. Which is to say, you leave the http://server:port out of the URL. The link is then "relative" to whichever page it was invoked from.
So if you did a hyperlink like:
<a href="/profoundui/userdata/custom/YOUR_FILE.pdf">Click for PDF</a>
It would point to the PDF file on the same system as the page that sent the <a> tag to the browser. If you move it to another system, no need to update it, because it'd be subsequently invoked from a page on a different system.
(You can also omit part of the directory structure if you want, and make the link relative to a given point in the directory structure. But, I think in your case, you probably want the whole directory path.)
Re: Opening PDFs
Posted: Wed Aug 22, 2012 2:45 pm
by rmullis
I tried using an icon with the onclick event set to pui.link("/profoundui/userdata/custom/manuals/menu.pdf"). It keeps coming back telling me the link is not found. I have verified that I have the file name and path correct.
I am trying to do this all in ProfoundUI. I am not proficient in the ways of the Javascript and web stuff.
Re: Opening PDFs
Posted: Wed Aug 22, 2012 2:57 pm
by rmullis
Nevermind Scott. I solved my problem. It was a loose connection between the brain and hands. I had my folder with my manuals in /profoundui/userdata. I meant for it to be in /profoundui/userdata/custom, which is what I had in my webpage.
Re: Opening PDFs
Posted: Wed Aug 22, 2012 3:47 pm
by Scott Klement
That's a great way to do it, very nice!