How to open PDF or HTML file within project folder?

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
smjadtnf707
Posts: 32
Joined: Sun May 19, 2019 7:26 pm

How to open PDF or HTML file within project folder?

Post by smjadtnf707 » Fri Jun 07, 2019 2:21 pm

Hello,

If I have my project folder,
and one of the folders is DOCS,
How do I use a button or linklabel and reference a file in the DOCS folder?
The document is a steps guide and that is all I need on that particular page, but...

Is there a way to reference files in folder better than me linking one file at a time?
My skill level is very basic and more so, single item actions but I know PSS is much more powerful and dynamic than what I am capable of making at this time.
Thank You,

Wayne

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: How to open PDF or HTML file within project folder?

Post by davidc » Fri Jun 07, 2019 2:50 pm

Are you trying to open a document with its default association from your GUI?

You can use Start-Process cmdlet to trigger the file to open:

Code: Select all

Start-Process -FilePath "Path To pdf file"
You can use the Click event for the button to trigger the cmdlet or the LinkLabel's LinkClicked event. I also recommend specifying a relative path.

Related article:

https://info.sapien.com/index.php/guis/ ... on-control
David
SAPIEN Technologies, Inc.

User avatar
smjadtnf707
Posts: 32
Joined: Sun May 19, 2019 7:26 pm

Re: How to open PDF or HTML file within project folder?

Post by smjadtnf707 » Fri Jun 07, 2019 3:40 pm

Hello,

Thank you, that worked.

I tried also

Code: Select all

Invoke-Item ".\Docs\DellSupport.pdf"
and that worked as well, but am going with your suggestion since you are the pros at this.

Thank you very much for the link as well, because although I do want an answer so my stuff works, I also want to know the how/why of code and understand as well.
Thank You,

Wayne

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: How to open PDF or HTML file within project folder?

Post by davidc » Fri Jun 07, 2019 4:06 pm

Invoke-Item is probably the prescribed way of doing it in PowerShell. For script related questions, I recommend posting our Script Answers forums:

viewforum.php?f=6
David
SAPIEN Technologies, Inc.