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

Can we make print button widget to download in particular folder.

AP_10343008
15-Moonstone

Can we make print button widget to download in particular folder.

Can we make print button to download in particular folder instead of downloading in downloads folder?

ACCEPTED SOLUTION

Accepted Solutions

Hi @AP_10343008 ,

If you want to save file to thingworx repository, you need to let users input "repository name", "path" and "file name" in Mashup, and under the hood trigger a custom service that executes functions like below that takes the user input to save file to specified destination.

 

Things["<RepositoryName>"].SaveBinary({
  path: undefined /* STRING */,
  content: undefined /* BLOB */
});

 

If you want users to download to local PC and specify target folder, users need to change the settings in browser as mentioned by Velkumar

Tony

View solution in original post

8 REPLIES 8
Velkumar
19-Tanzanite
(To:AP_10343008)

Hi @AP_10343008 

 

You can change download folder option in browser 

Velkumar_0-1723526759274.png

 

I don't think you can control it in widget level.

 

/VR

 

AP_10343008
15-Moonstone
(To:Velkumar)

That is common for every operation. 
I want to store file in repository when user clicked thingworx button widget, Apart from this activity, user can decide folder location for other browser related downloads. I want both to be two different locations independently.

 

 

 

Hi @AP_10343008 ,

If you want to save file to thingworx repository, you need to let users input "repository name", "path" and "file name" in Mashup, and under the hood trigger a custom service that executes functions like below that takes the user input to save file to specified destination.

 

Things["<RepositoryName>"].SaveBinary({
  path: undefined /* STRING */,
  content: undefined /* BLOB */
});

 

If you want users to download to local PC and specify target folder, users need to change the settings in browser as mentioned by Velkumar

Tony

What file type this api creates in the location?
I want to create excel file with exported data or pdf file in the provided path.

"path" parameter of this API is where you specify the path, the file name, and the file extension.

So which file type to create depends on how you specify the "path". (it can create any type as long as the file content is passed correctly)

See below example:

 

Things["<RepositoryName>"].SaveBinary({
  path: "/test.xlsx" /* STRING */,
  content: undefined /* BLOB */
});

Things["<RepositoryName>"].SaveBinary({
  path: "/test.pdf" /* STRING */,
  content: undefined /* BLOB */
});

 

 

Tony

This API accept only binary input. But i have infotable data to generate in excel. Do I need to convert infotable data to binary? If yes, how it can be done ?

I don't think infotable data can be converted to binary.

SaveBinary service is to be used when you already have an Excel file out there and  want to "download" it to your ThingWorx file repository.

Check out this article if you want to create an Excel file from ThingWorx using infotable data.

If needed, convert csv to Excel after without using TWX.

 

Tony

Hi @AP_10343008,

It appears that a response to this post answered your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate an appropriate response as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,

Tony
Announcements


Top Tags