From 7905b71feb783d1207a0c8bb2929bca33880147c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 3 Jan 2019 16:52:10 +0100 Subject: [PATCH] Set number of copies for iOS --- src/ios/APPPrinter.m | 4 +++- www/printer.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ios/APPPrinter.m b/src/ios/APPPrinter.m index 94518ff..c86fc9b 100755 --- a/src/ios/APPPrinter.m +++ b/src/ios/APPPrinter.m @@ -337,6 +337,7 @@ UIPrintInfoOrientation orientation = UIPrintInfoOrientationPortrait; UIPrintInfoOutputType outputType = UIPrintInfoOutputGeneral; UIPrintInfoDuplex duplexMode = UIPrintInfoDuplexNone; + long copies = MAX([settings[@"copies"] longValue], 1); if ([settings[@"landscape"] boolValue]) { orientation = UIPrintInfoOrientationLandscape; @@ -355,11 +356,12 @@ duplexMode = UIPrintInfoDuplexShortEdge; } + [printInfo setValue:[NSNumber numberWithLong:copies] forKey:@"_copies"]; + printInfo.outputType = outputType; printInfo.orientation = orientation; printInfo.duplex = duplexMode; printInfo.jobName = settings[@"name"]; - controller.printInfo = printInfo; controller.showsNumberOfCopies = ![settings[@"hideNumberOfCopies"] boolValue]; diff --git a/www/printer.js b/www/printer.js index 14ad192..f0519f3 100755 --- a/www/printer.js +++ b/www/printer.js @@ -28,16 +28,14 @@ var exec = require('cordova/exec'); */ exports.getDefaults = function () { return { - // Platform independent name: 'unknown', duplex: 'none', landscape: false, graystyle: false, - // iOS specific border: true, + copies: 1, hideNumberOfCopies: false, hidePaperFormat: false, - // iPad specific bounds: [40, 30, 0, 0] }; };