简体   繁体   English

全滚动截图 CHROME EXTENSION

[英]Full scroll screenshot CHROME EXTENSION

I want to capture full page scroll screenshot in my chrome extension.我想在我的 chrome 扩展程序中捕获整页滚动屏幕截图。 I use code below, but it only captures what i see on screen, but i want to capture full scrolled page.我使用下面的代码,但它只捕获我在屏幕上看到的内容,但我想捕获完整的滚动页面。 Can someone help me please?有人能帮助我吗? thanks in advance.提前致谢。

background.js:背景.js:

  chrome.tabs.captureVisibleTab(null, null, function(dataUrl) {  
})

Download screen capture from app store then follow instructions: Step 1: Go to the Chrome Web store and search for "screen capture" in the search box.从应用商店下载屏幕截图,然后按照说明操作: 第 1 步:转到 Chrome 网上应用店并在搜索框中搜索“屏幕截图”。

Step 2: Select the "Screen Capture (by Google)" extension and install it.第 2 步:选择“Screen Capture (by Google)”扩展程序并安装它。

Step 3: After installation, click on the Screen Capture button on the Chrome toolbar and select Capture Whole Page or use the keyboard shortcut, Ctrl+Alt+H.第 3 步:安装后,单击 Chrome 工具栏上的屏幕捕获按钮并选择捕获整个页面或使用键盘快捷键 Ctrl+Alt+H。

Step 4: You'll see Chrome scrolling down to capture the whole page and once finished, an options bar will display above the Web page that allows annotations, sharing, and saving the capture.第 4 步:您将看到 Chrome 向下滚动以捕获整个页面,完成后,网页上方将显示一个选项栏,允许注释、共享和保存捕获。

Please include the below script before tag请在标签前包含以下脚本

<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js"></script>

And include this:并包括这个:

FileSaver.js文件保护程序

html2canvas(document.body, {onrendered: function(canvas){canvas.toBlob(function(blob){ saveAs(blob, "wholePage.png");});}});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM