Skip to main content
1-Visitor
January 23, 2020
Solved

PDF Download using thingworx

  • January 23, 2020
  • 4 replies
  • 3736 views

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.

Best answer by TanmeyTWX

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.

 

4 replies

raluca_edu
17-Peridot
January 23, 2020

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

Lakshmit1-VisitorAuthor
1-Visitor
January 23, 2020

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.

TanmeyTWX17-PeridotAnswer
17-Peridot
January 27, 2020

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.