cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to open a PDF file in thinworx studio using button?

dsengupta
1-Newbie

How to open a PDF file in thinworx studio using button?

I am developing my own experience in thingworx studio. I have attached some buttons for opening some documents and videos using JS code in the home.js file by providing the links of the videos and the documents. Now I am trying to open a pdf file using the same procedure. While previewing the experience, the PDF file is opening, but after publishing when I am trying to open that from my tab, it's showing a white page.I have adobe reader installed in my tab. Is there any procedure I can use to open a PDF file in thingworx studio using buttons?

1 ACCEPTED SOLUTION

Accepted Solutions

As Giri proposed: you can add a Hyperlink widget and point the link to a URL of a pdf. Worked for me - just tried it with the following URL: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

I didn't try it yet - you can check if you can find a way to programmatically invoke (click) the Hyperlink widget from your button click. Or you can try to change the style of the hyperlink so that it looks like a button.

View solution in original post

5 REPLIES 5

I doubt if accessing pdf from the canvas is allowed. You can redirect the Button click to an url of that pdf file. Or else, as a workaround, you can try converting the pdf page into an image and display it in the View canvas.

-Giri

Thanx giri for your reply. I have tried using button click. It's not working. And making the pdf into an image won't be encouraged in my project. Please let me know if there is any other way to achieve the task..

Thank you

As Giri proposed: you can add a Hyperlink widget and point the link to a URL of a pdf. Worked for me - just tried it with the following URL: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

I didn't try it yet - you can check if you can find a way to programmatically invoke (click) the Hyperlink widget from your button click. Or you can try to change the style of the hyperlink so that it looks like a button.

Thanx Moritz.. It worked!!

regards,

Dipika

If you want to open a URL without the Hyperlink widget you can use the following in JS and bind it to whatever you like. And if you put in the "share" URL for another experience it will open directly in View on devices.

window.open('htttp://sfdsfds.com');
 
 
Update: this only works on Android, not iOS 😞
Top Tags