Skip to main content
14-Alexandrite
January 22, 2021
Solved

how to generate pdf or excel file in thingworx??

  • January 22, 2021
  • 2 replies
  • 4161 views

 Hello,

          I'm using Thingworx 9.0 version and I want to generate pdf file. I'll refer this post and I import an pdf extension in Thingworx and follow all steps with give an all inputs to parameter But I'm getting an error ,when I click on button. I'll search on this error and refer this post but it is not working so Please refer the below attachment and suggest

1) How Do I generate pdf and excel file when I click on create PDF button??  OR

2) Is their another way to generate pdf file by taking screenshot of any mashup and generating an pdf or excel file

 

Thanks in advance

Best answer by mgoel

Hi @RM12 

 

You can use write csv function from snippet. See the below example:

 

let params1 = {
path: "/abc.csv" /* STRING */,
data: result /* INFOTABLE */,
fileRepository: "SystemRepository" /* THINGNAME */,
withHeader: true /* BOOLEAN */
};

// no return
Resources["CSVParserFunctions"].WriteCSVFile(params1);

 

Pass result of any service which in the result variable which you want to write in csv.

 

Regards,

Mohit

2 replies

Community Manager
January 22, 2021

Hi @RM12.

 

The PDF extension that was previously found on the Marketplace is not compatible with 9.0.  Currently there is no option to generate PDF files in ThingWorx.  However, there are requests for this on the ThingWorx Ideas forum.  I encourage you to vote for these to improve the possibility they will be included in future releases.

 

For Excel, you can install the CSV Parser extension available on the PTC Download page:

 

 

Regards.

 

--Sharon

22-Sapphire I
January 22, 2021

You can CSV as well using the data export widget

Also you could write a file to the file repository directly in the back end.

Rest api also supports text/csv return

RM1214-AlexandriteAuthor
14-Alexandrite
January 24, 2021

Thanks for your reply ,Can you please explain in detail how do I used CSV parse function for generating report file (CSV)???

mgoel5-Regular MemberAnswer
5-Regular Member
January 24, 2021

Hi @RM12 

 

You can use write csv function from snippet. See the below example:

 

let params1 = {
path: "/abc.csv" /* STRING */,
data: result /* INFOTABLE */,
fileRepository: "SystemRepository" /* THINGNAME */,
withHeader: true /* BOOLEAN */
};

// no return
Resources["CSVParserFunctions"].WriteCSVFile(params1);

 

Pass result of any service which in the result variable which you want to write in csv.

 

Regards,

Mohit