From: Cheng Zhao Date: Fri, 22 Nov 2013 06:39:10 +0000 (+0800) Subject: doc: Explain BrowserWindow.capturePage. X-Git-Tag: v0.6.12~1^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=33ad68f7a7f29b1f0409055dbcfb2dd67ef63e5d;p=electron.git doc: Explain BrowserWindow.capturePage. --- diff --git a/docs/api/browser/browser-window.md b/docs/api/browser/browser-window.md index 0977b077..eb9f6dd9 100644 --- a/docs/api/browser/browser-window.md +++ b/docs/api/browser/browser-window.md @@ -290,6 +290,23 @@ Starts inspecting element at position (`x`, `y`). ### BrowserWindow.restartHangMonitorTimeout() +### BrowserWindow.capturePage([rect, ]callback) + +* `rect` Object - The area of page to be captured + * `x` + * `y` + * `width` + * `height` +* `callback` Function + +Captures the snapshot of page within `rect`, upon completion `callback` would be +called with `callback(image)`, the `image` is a `Buffer` that stores the PNG +encoded data of the snapshot. Omitting the `rect` would capture the whole +visible page. + +You can write received `image` directly to a `.png` file, or you can base64 +encode it and use data URL to embed the image in HTML. + ### BrowserWindow.getPageTitle() Returns the title of web page.