From 86a74dc2ff3244aaa7724c12ac00895de98b441d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Sun, 31 Jul 2016 14:50:24 +0200 Subject: [PATCH] Support print options on windows --- src/windows/PrinterProxy.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/windows/PrinterProxy.js b/src/windows/PrinterProxy.js index f0e1131..a89a153 100644 --- a/src/windows/PrinterProxy.js +++ b/src/windows/PrinterProxy.js @@ -21,7 +21,8 @@ under the License. */ -var PrintManager = Windows.Graphics.Printing.PrintManager; +var Printing = Windows.Graphics.Printing, + PrintManager = Windows.Graphics.Printing.PrintManager; /** * Verifies if printing is supported on the device. @@ -92,6 +93,29 @@ exports.onPrintTaskRequested = function (event) { args.setSource(exports._page); }); + if (config.graystyle) { + task.options.colorMode = Printing.PrintColorMode.grayscale; + } else { + task.options.colorMode = Printing.PrintColorMode.color; + } + + if (config.landscape) { + task.options.orientation = Printing.PrintOrientation.landscape; + } else { + task.options.orientation = Printing.PrintOrientation.portrait; + } + + if (config.duplex == 'long') { + task.options.duplex = Printing.PrintDuplex.twoSidedLongEdge; + } else + if (config.duplex == 'short') { + task.options.duplex = Printing.PrintDuplex.twoSidedShortEdge; + } else { + task.options.duplex = Printing.PrintDuplex.oneSided; + } + + task.options.numberOfCopies = config.copies || 1; + task.oncompleted = function (e) { exports._func(e.detail[0].completion == 3); };