]> khamidou — GitHub mirrors - electron.git/commitdiff
:memo: pageSize option.
authorHaojian Wu <hokein.wu@gmail.com>
Sun, 26 Jul 2015 03:56:07 +0000 (11:56 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Sun, 26 Jul 2015 03:57:53 +0000 (11:57 +0800)
docs/api/browser-window.md

index c8fc39a53f1ffce0bda20bd1fff3dc8269029b0b..cee68183f78305fd55fa199816227e0882eb9322 100644 (file)
@@ -1001,6 +1001,12 @@ size.
     * 0 - default
     * 1 - none
     * 2 - minimum
+  * `pageSize` String - Specify page size of the generated PDF
+    * `A4`
+    * `A3`
+    * `Legal`
+    * `Letter`
+    * `Tabloid`
   * `printBackground` Boolean - Whether to print CSS backgrounds.
   * `printSelectionOnly` Boolean - Whether to print selection only.
   * `landscape` Boolean - `true` for landscape, `false` for portrait.
@@ -1027,9 +1033,10 @@ win.webContents.on("did-finish-load", function() {
   // Use default printing options
   win.webContents.printToPDF({}, function(error, data) {
     if (error) throw error;
-    fs.writeFile(dist, data, function(error) {
+    fs.writeFile("/tmp/print.pdf", data, function(error) {
       if (err)
-        alert('write pdf file error', error);
+        throw error;
+      console.log("Write PDF successfully.");
     })
   })
 });