Skip to main content
Aug 25, 2016 7:36 AM UTC
Solved

Can I download a file located in a FileRepository to the client download folder?

I have a PDF file that I have created and is located in the Filerepository. Now I'm looking for a way to download it to the clients download folder on his local system.

Aug 25, 2016 7:47 AM UTC

Hi Steven,

You should add a Link widget on the mashup, and set widget SourceURL property with the File Link ( something like "/Thingworx/FileRepository/yourRepositoryName/yourFileName.pdf" ) set TargetWindow property to "New Window", then you just need to trigger "Navigate" event on this widget . If you want to hide it all for the user, you just need to make the Link widget invisible, and trigger the Navigate event through the response of the service which generates the PDF.

P.D.: Give regards to Tim Evers and Tom Drieman, we had a nice TW training time in Aux-En-Provence a year ago

Carles.

4 replies

Aug 25, 2016 7:47 AM UTC

Hi Steven,

You should add a Link widget on the mashup, and set widget SourceURL property with the File Link ( something like "/Thingworx/FileRepository/yourRepositoryName/yourFileName.pdf" ) set TargetWindow property to "New Window", then you just need to trigger "Navigate" event on this widget . If you want to hide it all for the user, you just need to make the Link widget invisible, and trigger the Navigate event through the response of the service which generates the PDF.

P.D.: Give regards to Tim Evers and Tom Drieman, we had a nice TW training time in Aux-En-Provence a year ago

Carles.

Aug 25, 2016 8:09 AM UTC

Hi,

I will do

Thank you for the response. This will solve my problem.

Is their also a solution in jave code. That way I can embed it in the resource I have written to build the PDF.

Aug 25, 2016 8:12 AM UTC

Hi,

No you can't force a download from Java on the browser side, you need to trigger it from the mashup ( which it's executed on Browser side ).

Carles