duplex
accepts an string now instead of boolean
This commit is contained in:
parent
43c325317a
commit
031f4b385a
@ -5,7 +5,8 @@
|
|||||||
- [__change__:] `isAvailable` returns false if no enabled print services can be found (Android)
|
- [__change__:] `isAvailable` returns false if no enabled print services can be found (Android)
|
||||||
- [enhancement:] `isAvailable` returns additional list of available print services (Android)
|
- [enhancement:] `isAvailable` returns additional list of available print services (Android)
|
||||||
- [enhancement:] `print` returns bool value to indicate the result
|
- [enhancement:] `print` returns bool value to indicate the result
|
||||||
- [enhancement:] Support `duplex` attribute (Android)
|
- [enhancement:] Added missing `duplex` support (Android)
|
||||||
|
- [__change__:] `duplex` requires a string (`none`, `long` or `short`)
|
||||||
|
|
||||||
|
|
||||||
#### Version 0.7.1 (23.04.2015)
|
#### Version 0.7.1 (23.04.2015)
|
||||||
|
@ -117,6 +117,7 @@
|
|||||||
UIPrintInfo* printInfo = [UIPrintInfo printInfo];
|
UIPrintInfo* printInfo = [UIPrintInfo printInfo];
|
||||||
UIPrintInfoOrientation orientation = UIPrintInfoOrientationPortrait;
|
UIPrintInfoOrientation orientation = UIPrintInfoOrientationPortrait;
|
||||||
UIPrintInfoOutputType outputType = UIPrintInfoOutputGeneral;
|
UIPrintInfoOutputType outputType = UIPrintInfoOutputGeneral;
|
||||||
|
UIPrintInfoDuplex duplexMode = UIPrintInfoDuplexNone;
|
||||||
|
|
||||||
if ([[settings objectForKey:@"landscape"] boolValue]) {
|
if ([[settings objectForKey:@"landscape"] boolValue]) {
|
||||||
orientation = UIPrintInfoOrientationLandscape;
|
orientation = UIPrintInfoOrientationLandscape;
|
||||||
@ -126,10 +127,17 @@
|
|||||||
outputType = UIPrintInfoOutputGrayscale;
|
outputType = UIPrintInfoOutputGrayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([[settings objectForKey:@"duplex"] isEqualToString:@"long"]) {
|
||||||
|
duplexMode = UIPrintInfoDuplexLongEdge;
|
||||||
|
} else
|
||||||
|
if ([[settings objectForKey:@"duplex"] isEqualToString:@"short"]) {
|
||||||
|
duplexMode = UIPrintInfoDuplexShortEdge;
|
||||||
|
}
|
||||||
|
|
||||||
printInfo.outputType = outputType;
|
printInfo.outputType = outputType;
|
||||||
printInfo.orientation = orientation;
|
printInfo.orientation = orientation;
|
||||||
|
printInfo.duplex = duplexMode;
|
||||||
printInfo.jobName = [settings objectForKey:@"name"];
|
printInfo.jobName = [settings objectForKey:@"name"];
|
||||||
printInfo.duplex = [[settings objectForKey:@"duplex"] boolValue];
|
|
||||||
|
|
||||||
controller.printInfo = printInfo;
|
controller.printInfo = printInfo;
|
||||||
controller.showsPageRange = NO;
|
controller.showsPageRange = NO;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2013-2014 appPlant UG
|
Copyright 2013-2016 appPlant GmbH
|
||||||
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
@ -21,11 +21,6 @@
|
|||||||
|
|
||||||
var exec = require('cordova/exec');
|
var exec = require('cordova/exec');
|
||||||
|
|
||||||
/**
|
|
||||||
* The default document/job name.
|
|
||||||
*/
|
|
||||||
exports.DEFAULT_DOC_NAME = 'unknown';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of all available options with their default value.
|
* List of all available options with their default value.
|
||||||
*
|
*
|
||||||
@ -33,9 +28,10 @@ exports.DEFAULT_DOC_NAME = 'unknown';
|
|||||||
*/
|
*/
|
||||||
exports.getDefaults = function () {
|
exports.getDefaults = function () {
|
||||||
return {
|
return {
|
||||||
name: exports.DEFAULT_DOC_NAME,
|
name: 'unknown',
|
||||||
duplex: true,
|
duplex: 'none',
|
||||||
landscape: false,
|
landscape: false,
|
||||||
|
graystyle: false,
|
||||||
bounds: [40, 30, 0, 0]
|
bounds: [40, 30, 0, 0]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -87,7 +83,7 @@ exports.print = function (content, options, callback, scope) {
|
|||||||
params = this.mergeWithDefaults(params);
|
params = this.mergeWithDefaults(params);
|
||||||
|
|
||||||
if ([null, undefined, ''].indexOf(params.name) > -1) {
|
if ([null, undefined, ''].indexOf(params.name) > -1) {
|
||||||
params.name = this.DEFAULT_DOC_NAME;
|
params.name = this.getDefaults().name;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(fn, null, 'Printer', 'print', [page, params]);
|
exec(fn, null, 'Printer', 'print', [page, params]);
|
||||||
@ -117,6 +113,10 @@ exports.mergeWithDefaults = function (options) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.duplex && typeof options.duplex == 'boolean') {
|
||||||
|
options.duplex = options.duplex ? 'long' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
for (var key in defaults) {
|
for (var key in defaults) {
|
||||||
if (!options.hasOwnProperty(key)) {
|
if (!options.hasOwnProperty(key)) {
|
||||||
options[key] = defaults[key];
|
options[key] = defaults[key];
|
||||||
|
Loading…
Reference in New Issue
Block a user