]> khamidou — GitHub mirrors - electron.git/commitdiff
doc: Explain BrowserWindow.capturePage.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 22 Nov 2013 06:39:10 +0000 (14:39 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 22 Nov 2013 06:39:10 +0000 (14:39 +0800)
docs/api/browser/browser-window.md

index 0977b077cfc4e50df44ad5069dfbcb94e894197c..eb9f6dd967dece782753eb9f922979ebdf298162 100644 (file)
@@ -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.