Trigger Screenshot with Javascript

Is it possible to trigger the screenshot creation from javascript?

Yes, it is: GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene.