From 74f2e9f102146e32b55d0c8a1ba4ee560fd6383e Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sun, 26 Jul 2015 11:56:07 +0800 Subject: [PATCH] :memo: pageSize option. --- docs/api/browser-window.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index c8fc39a53f1..cee68183f78 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -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."); }) }) });