.then(function(config) {
$scope.printConfig = config;
- if (!$scope.defaultPrinter) return;
+ var pname = '';
+ if ($scope.defaultPrinter) {
+ pname = $scope.defaultPrinter.name;
+
+ } else if ($scope.printers.length == 1) {
+ // if the OS does not report a default printer, but only
+ // one printer is available, treat it as the default.
+ pname = $scope.printers[0].name;
+ }
// apply the default printer to every context which has
// no printer configured.
if (!$scope.printConfig[ctx]) {
$scope.printConfig[ctx] = {
context : ctx,
- printer : $scope.defaultPrinter.name
+ printer : pname
}
}
}