Opening PDFs
-
- Experienced User
- Posts: 100
- Joined: Tue Feb 21, 2012 1:24 pm
- First Name: Robert
- Last Name: Mullis
- Company Name: WRC
- State / Province: Georgia
- Country: United States
- Contact:
Opening PDFs
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?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Opening PDFs
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?
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?
-
- Experienced User
- Posts: 100
- Joined: Tue Feb 21, 2012 1:24 pm
- First Name: Robert
- Last Name: Mullis
- Company Name: WRC
- State / Province: Georgia
- Country: United States
- Contact:
Re: Opening PDFs
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.
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.
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Opening PDFs
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.)
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.)
-
- Experienced User
- Posts: 100
- Joined: Tue Feb 21, 2012 1:24 pm
- First Name: Robert
- Last Name: Mullis
- Company Name: WRC
- State / Province: Georgia
- Country: United States
- Contact:
Re: Opening PDFs
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.
I am trying to do this all in ProfoundUI. I am not proficient in the ways of the Javascript and web stuff.
-
- Experienced User
- Posts: 100
- Joined: Tue Feb 21, 2012 1:24 pm
- First Name: Robert
- Last Name: Mullis
- Company Name: WRC
- State / Province: Georgia
- Country: United States
- Contact:
Re: Opening PDFs
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.
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Opening PDFs
That's a great way to do it, very nice!
Who is online
Users browsing this forum: No registered users and 4 guests