Taking full page screenshot with a Chrome extension

蓝咒 提交于 2021-02-11 17:35:42

问题


Is there away to capture a screenshot of the full page, including what is below the fold, in a Chrome Extension?

The captureVisibleTab seems to be limited to what is displayed within the visible area.


回答1:


You're limited to capturing the visible page via captureVisibleTab unless you use Flash or NPAPI.




回答2:


The standard approach seems to be to scroll around the page and capture screenshots at each part and then stick them all together. The official google screen capture plugin does this, but I found it to be buggy (at least on Mac OSX), so I wrote my own full page screen capture extension.

Source code here (relevant code in page.js and popup.js).




回答3:


On Macs, while not a Chrome extension, you can use the following AppleScript to automate the process found here:

https://zapier.com/blog/full-page-screenshots-in-chrome/

tell application "Google Chrome" to activate
  tell application "System Events"
  keystroke "i" using {option down, command down}
  delay 0.3
  keystroke "p" using {shift down, command down}
  delay 0.3
  keystroke "Full"
  delay 0.5
  key code 76
end tell

Open ScriptEditor and paste that script in. Save it as a file wherever you need it locally. When you run it by pressing play in ScriptEditor, it will automatically save a full screenshot of the active tab to your Downloads folder.




回答4:


Chrome 59 adds a new feature in DevTools called Capture full-size screenshot. But I don't know whether this API can be called by extensions.



来源:https://stackoverflow.com/questions/65786002/embed-js-code-in-the-for-loop-of-the-tabs-array-to-get-full-window-length-page-j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!