Is there a way to take screen shots / screen captures in Perspective as we did in Vision with system.print functions? I’m thinking of using the system.perspective.download function to print out a byte array of an image/png to a file. It looks like system.file and system.print do not function with Perspective, however.
Any ideas here? And would you have to grab the session as the Vision equivalent of a parent window’s parent?
This would currently require a custom module - capturing screenshots from web browsers is a surprisingly complicated problem. Your best bet in the short term might be to try to train users to use built-in browser tools - new versions of Firefox, for instance, have a very powerful built in screenshotting tool.
What’s the use case of these screenshots, out of curiosity?
I hadn’t noticed this… nice tip!
Really? That’s super interesting that the problem is more complicated than it seems!
The screenshots are to be used for a “Support Ticket” type functionality, where if an operator or someone sees something wrong with something (e.g. a value is wrong, or something is mislabeled or misspelled), finds a weird bug, or has a feature request, they can submit some details and it automatically snaps an image of the current screen.
So it works on Vision for sure, but our client is pushing to move things to Perspective now and I advised of some loss of functionality, this potentially being one.
If we were to do a custom module, what packages would likely be needed?
Internally, we use
html2canvas to generate the view thumbnails used in the designer.
Cool, thanks! I’m going to play around with this and a few other things to see the feasibility of taking screenshots in Perspective. Looks like a few python packages could potentially do this as well, but I have to verify that.
Wow, I hadn’t noticed that Firefox option either. Nice.
I have a customer that would like to screenshot their charts from a timeseries chart. They asked about taking screenshots within a perspective app. An image export method on the time series chart would satisfy their wants.
There are some security considerations to make with screenshots (for the browser vendors that is). In the old days, you could have an iframe. If you take a screenshot of that, it could potentially show data from a logged in user on a different site.
Today, you have the shadow dom which is encapsulated. This can also be used to log in somewhere else and show private data. Though AFAIK, it’s less automatic than iframe login.
So just saving the actual rendering will be a security issue. Taking the already accessible DOM, and rendering it somewhere (on the server or on a canvas) is not an issue.
There are however newer APIs that enable screen sharing, even of apps outside the browser. But those require explicit permission from the user. https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture
With the new workstation is it now possible to add screenshot of current page in perspective?
Not presently, although it looks like it might be possible to expose a JxBrowser method. I’d suggest an ideas.inductiveautomation.com post, so we can gauge community interest in the feature.
Has this gotten any traction? I would like to be able to screen shot a portion of a perspective view. This would be running in workstation in kiosk mode.