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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Taking screenshot and downloading the page

Hariharasuthan
12-Amethyst

Taking screenshot and downloading the page

i want to take a screenshot of a particular page, in that page there is a button, if i click the button page it should get downloaded

 

9 REPLIES 9

Hello,

 

What is the use case for this?
Why could you not just use the snipping tool (if you are on windows)?

 

Regards,

Jens

Hi jens,

Use Case: I have a Mashup page, that page i want to create one download button. If i click that button, it take a corresponding page screenshot and that screenshot  to be downloaded by image or Pdf File format.   

 

I need code for that above use case. 

 

thanks And regards

Hariharasuthan

Hello @Hariharasuthan,

 

I don't think there is any way of doing this out of the box with the widgets provided by PTC.

So short of creating your own widget, my suggestions would be to use either of the following two ways:

 

1. Screen shot using snipping tool (for windows).

2. In chrome, right click (or use ctrl-p) in the mashup and use the print function to save as PDF.

 

Hope this helps.

 

Regards,

Jens

I agree with Jens. For such functionality, that does not exist in the platform, it is expected that the developer will create it by using either the Extension SDK (in Java, if you want to do that server side) or a Widget (packaged still as an extension; using a widget will allow you to do that client side, using any Javascript library that may do this.). If you ask me, I would suggest doing it via a Widget, and yes, loosing the automation that the server would allow you, just because I haven't been able to find a good headless browser I can interact with to take the screenshots.

Hi @Hariharasuthan 

 

Maybe this widget will be helpful for you.

 

I created this simple print button 2 years back. When you click on the print button (don't worry about button size it is a responsive widget ) it opens the browser print menu (simple Ctrl + P action) and you can save the page as a PDF file 

Velkumar_0-1683260821648.png

Velkumar_1-1683260913238.png

 

If it is useful for you - Download Link

 

/VR

dear @Velkumar 

   this is very usefully.  i  tried print button successfully came result ,   Thanks.

 

 

 

Hello,

I think it's already visible in the screenshot above, but the output of the suggested Print functionality is not how the mashup will look for the end user.

Each browser applies print styles in the print window. As a result, the output PDF will not contain the mashup as the user sees it, but modified with less colors etc.

It may satisfy the end user, but it should also be verified that this solution is satisfactory.

I suggest using something like jsPDF, which will allow you to obtain a PDF that contains exactly what the user sees.

 

 

 
 

hi @Velkumar 

your share download link  , i    downloaded then export your file means  return thingworx 9.3 some error

 

[SECURITY FAILURE Anonymous:@unknown -> /ExampleApplication/IntrusionDetector] Invalid input: context=HTTP header value: cookie, type(HTTPHeaderValue_cookie)=^[a-zA-Z0-9()\-=\*\.\?;,+\/:&_|% ]*$, input=JSESSIONID=A3461D33D8DF59AA006499D8E7C5F551; ab.storage.deviceId.a9882122-ac6c-486a-bc3b-fab39ef624c5={"g":"36f9226e-876c-6867-4c2f-d7fbb217c2f2","c":1679912898303,"l":1679912898303}

 

 

Attached extension 

 

 

Top Tags