For html apps i found a good solution using a javascript library...
function doscreenshot(){
setTimeout(function(){
const node = document.body;
const scale = 3000 / node.offsetWidth;
this.shot_loading = true;
domtoimage
.toJpeg(node, {
height: node.offsetHeight * scale,
width: node.offsetWidth * scale,
style: {
transform: "scale(" + scale + ")",
transformOrigin: "top left",
width: node.offsetWidth + "px",
height: node.offsetHeight + "px"
}
})
.then(dataUrl => {
var path = app.GetSpecialFolder( "Pictures" )+"/Routes/"+dt.toISOString().replaceAll(":","")+".jpg";
img = app.CreateImage( null,.3,.15);
img.SetPixelData(dataUrl );
img.Save(path);
alert(language.efectuat + "\n" + path);
app.OpenFile( path , "image/jpeg", "Choose Editor" );
})
.catch(error => {
this.shot_loading = false;
console.error("oops, something went wrong!", error);
});
},500);
}