min icon indicating copy to clipboard operation
min copied to clipboard

Full-page screenshots

Open nwdxlgzs opened this issue 5 years ago • 5 comments

Adding Screen Capture Function

nwdxlgzs avatar Jun 28 '19 05:06 nwdxlgzs

Can you provide a little more detail about how you would see this working. I personally use a separate app for screen capture. Curious about more details for it being part of the browser.

dbfreem avatar Jun 28 '19 10:06 dbfreem

对于添加截图功能,我知道有以下方法。 1.用单独一个程序截图(很简单,但是需要另一个软件,而且不可以浏览器全尺寸截图) 2.使用electron自带的方法(见api demo,我知道这个可行,仅此而已,至于缺点不知道) 3.使用Chromium(比较新的内核就行,目前electron5已经支持)的命令。(dev-tools中ctrl+shift+p打开,输入screenshot,有几种截图方法。)这个可以截全尺寸图,而且现在的electron内核版本已经支持,就是不知道能不能通过js使用。问题是截图后提示“下载保存”,不知道能不能直接拦截,直接下载保存到硬盘。 4.这个方法不靠谱,但可以实现:html2canavas(部分网页内容会有问题,而且对图片兼容不太好,视频没测试,估计更不友好)后canvas2png,但也提示要下载。

我提议加入截图功能是因为为了像Edge那样做笔记。这个很不错,配合阅读器和PDF功能,为学习生活提供便利帮助。

对于pepperflash.dll,我有一个想法,我已经实现了启用,其中,我发现他可以使用系统自带的pepperflash,你可以做一个按钮,控制是否启用(启用时明确提示用户使用flash的缺点)。但是,对于某些直播视频流,不用flash好像不能正常使用。

中文为原始语言,英语为翻译后的语言,可能翻译不准确,可以参照中文在谷歌翻译里翻译。 :::::::::::::::::::::::: For adding screenshots, I know there's a way.

  1. Screenshot with a separate program (very simple, but requires another software, and can not browser full-size screenshots)
  2. Use electron's own method (see api demo, I know this is feasible, that's all, as for the shortcomings don't know)
  3. Use the Chromium (newer kernel on the line, currently supported by electron5) command. (the ctrl and shift-p in dev-tools open, enter the ensto, there are several methods of screenshot.) This can be intercepted full-size diagram, and now the electron kernel version is already supported, just do not know whether can be used through js. The problem is that after the screenshot prompt "download save", do not know whether can directly intercept, direct download saved to the hard disk.
  4. This method is not reliable, but can be achieved: html2canavas (some web content will be problematic, and the image compatibility is not very good, the video was not tested, estimated to be more unfriendly) after canvas2png, but also promptto download.

I proposed adding a screenshot feature because I wanted to take notes like Edge. This is very good, with reader and PDF features, to facilitate learning life help.

For pepperflash.dll, I have an idea that I have implemented enabled,Among them, I found that electron supports the use of the system's pepperflash.dll, you can add this feature to the settings, because some live streams do not need flash to watch.

Chinese is the original language, English is the language of translation by app, may not express correctly, please refer to the Chinese with Google and other translation

nwdxlgzs avatar Jun 28 '19 11:06 nwdxlgzs

The translation seems fairly understandable; hopefully this still makes sense when translated back to Chinese.

There's already a !screenshot command you can enter in the searchbar that takes a screenshot using the capturePage API, but it only captures what's currently visible, and not the entire page, I agree this would be a good feature to have, but I don't see any easy way to implement it using the API's available in electron, and I don't think it's possible for us to use the commands from the developer tools. Html2Canvas is slow and doesn't work on a lot of pages, so it wouldn't work well enough from this.

For note taking, it seems like it would be even better to be able to take notes directly on top of the page, rather than saving it as an image first. I've thought about adding some kind of note-taking to Min before, but I'm not sure exactly how it would work; maybe there's a better way to do this?

PalmerAL avatar Jun 29 '19 03:06 PalmerAL

In chrome I use this extension https://github.com/mrcoles/full-page-screen-capture-chrome-extension. Maybe it's viable to implement in Min Browser.

manoger avatar Aug 25 '23 13:08 manoger

I figured it out. image image I've created two userscripts that works well. Here's the not forced version:

// ==UserScript==
// @name Full Page Screenshot
// @match *
// @run-at context-menu
// ==/UserScript==

(function() {
    // Load the FileSaver.js library for saving the screenshot
    var fileSaverScript = document.createElement('script');
    fileSaverScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js';
    document.head.appendChild(fileSaverScript);

    // Load the html2canvas library for capturing the screenshot
    var html2canvasScript = document.createElement('script');
    html2canvasScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.min.js';
    document.head.appendChild(html2canvasScript);

    // Function to capture and save the screenshot
    function captureAndSaveScreenshot() {
        // Add a delay (you can adjust the value as needed)
        setTimeout(function() {
            // Check if the page is blocking scripts
            if (typeof html2canvas === 'undefined') {
                alert('This website is blocking the necessary script. Screenshot capture is not possible.');
                return;
            }

            html2canvas(document.body).then(function(canvas) {
                canvas.toBlob(function(blob) {
                    saveAs(blob, 'screenshot.png');
                });
            });
        }, 1000); // 1000 milliseconds = 1 second
    }

    // Call the screenshot function immediately
    captureAndSaveScreenshot();
})();

manoger avatar Aug 25 '23 16:08 manoger