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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

PDF Download using thingworx

Lakshmit
9-Granite

PDF Download using thingworx

Hi Experts,

 

I am trying to download PDF using ExportPDF extension but facing issues.

When I execute CreatePDF service with required inputs and execute it, the service is showing just executing as status and not giving any output or error. 

Can someone help me how can I download PDF in thingworx, Is there a way we can download pdf without using ExportPDF extension.

 

Best Regards

Lakshmi.

1 ACCEPTED SOLUTION

Accepted Solutions

Please try below steps and let me know,if it works for you.

 

1. Import latest PDF extension from marketplace/Thingworx labs.

2. You will get PDF Export as a Resource added to Composer. 

3. On Event,configure and trigger the service "CreatePDF"

 

var params = {
FileRepository: " " /* THINGNAME */,
Rotated90Deg: false /* BOOLEAN */,
AppKey: "KEY"/* STRING */,
ServerAddress: " " /* STRING */,
OutputFileName: "FileName" /* STRING */,
Resolution: '1240*1775' /* STRING */
};

// result: STRING
var generatePDF = Resources["PDFExport"].CreatePDF(params);

 

4.Use GetFileListingWithLinks service to get the file using below syntax and pass it to Link widget.

var result = fileWithLink.rows[0].downloadLink;

 

5.Bind the service result to a Link widget and keep target window to same window option.

 

View solution in original post

4 REPLIES 4

Hi,

 

1. One idea is to use REST API for the PDF file.

2. I don't understand from where you want to download PDF, but if you have the file in a Repository on Thingworx Server you can use service GetFileListingWithLinks available for any repository thing.

See below:

raluca_edu_0-1579781602600.png

 

Hope it helps,

Raluca Edu

Hi Raluca, 

Thank you for help.

I want to create a PDF from Thingworx  mashup using CreatePDF service of ExportPDF extension.

while executing service it is not showing any update.Attaching screen shot for reference.

Please try below steps and let me know,if it works for you.

 

1. Import latest PDF extension from marketplace/Thingworx labs.

2. You will get PDF Export as a Resource added to Composer. 

3. On Event,configure and trigger the service "CreatePDF"

 

var params = {
FileRepository: " " /* THINGNAME */,
Rotated90Deg: false /* BOOLEAN */,
AppKey: "KEY"/* STRING */,
ServerAddress: " " /* STRING */,
OutputFileName: "FileName" /* STRING */,
Resolution: '1240*1775' /* STRING */
};

// result: STRING
var generatePDF = Resources["PDFExport"].CreatePDF(params);

 

4.Use GetFileListingWithLinks service to get the file using below syntax and pass it to Link widget.

var result = fileWithLink.rows[0].downloadLink;

 

5.Bind the service result to a Link widget and keep target window to same window option.

 

slangley
23-Emerald II
(To:TanmeyTWX)

Hi @Lakshmit.

 

If one of the previous responses answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags