You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 10, 2018. It is now read-only.
resize the window (content size + window.outer<S> - window.inner<S>)
take screenshot
resize back to original size
Some tentative code:
Logger.debug('getScreenshot()');screenshotResponse=null;currWindow.webContents.executeJavaScript('({'+'cw: document.body.clientWidth,'+'ch: document.body.clientHeight,'+'pw: window.outerWidth - window.innerWidth,'+'ph: window.outerHeight - window.innerHeight'+'})',false,function(s){constscaleFactor=Electron.screen.getPrimaryDisplay().scaleFactor,origSize=currWindow.getSize();Logger.alert('Setting window size to %dx%d...',s.cw+s.pw,s.ch+s.ph);currWindow.setSize(s.cw+s.pw,s.ch+s.ph,false);Logger.alert('Window size is now: %j',currWindow.getSize());consttryTakingScreenshot=function(tries){currWindow.capturePage(/*{ x: 0, y: 0, width: +s.cw * scaleFactor, height: +s.ch * scaleFactor },*/function(image){constdata=image.toPNG().toString('base64');if(data){screenshotResponse={'base64data': data};currWindow.setSize(origSize[0],origSize[1],false);}elseif(tries>0){Logger.warn('Failed to take screen shot, trying again (try %d).',tries);setTimeout(function(){tryTakingScreenshot(tries-1);},200);}else{screenshotResponse={'error': 'Gave up trying to take screen shot after several tries.'};currWindow.setSize(origSize[0],origSize[1],false);}});};tryTakingScreenshot(5);});cb();
This seems to be a known limitation of Electron.
Potential solution:
document.body.scroll<S>
)window.outer<S> - window.inner<S>
)Some tentative code:
Also see: https://github.com/FWeinb/electron-screenshot-app/blob/6c165089797d30ad66a0b19398ca52446e0d3e88/index.js
The text was updated successfully, but these errors were encountered: