Permalink
Browse files

* Change args management.

* Fix media size option & fitplot.
  • Loading branch information...
1 parent 5b2a043 commit 7993bf49995da8152c47af302f058c205afd9126 @armetiz committed Sep 20, 2012
Showing with 19 additions and 19 deletions.
  1. +7 −0 CHANGELOG
  2. +12 −19 printer.js
View
@@ -1,3 +1,10 @@
+==1.0.3==
+* Change args management.
+* Fix media size option & fitplot.
+
+==1.0.2==
+* Fix version in package.json
+
==1.0.1==
* Add support for media size option.
* Add support for fit plot.
View
@@ -12,8 +12,8 @@ var optionsFactory = function (options) {
defaultOptions.hostname = null;
defaultOptions.numCopies = 1;
defaultOptions.priority = 1;
- defaultOptions.mediaSize = "a4";
- defaultOptions.fitPlot = false;
+ defaultOptions.media = "a4";
+ defaultOptions.fitplot = false;
return _.defaults(options, defaultOptions);
};
@@ -26,42 +26,35 @@ var argsFactory = function (options) {
}
if (_.isString(options.username)) {
- args.push("-U");
- args.push(options.username);
+ args.push("-U " + options.username);
}
if (true === options.backwardsCompatibility) {
args.push("-c");
}
if (_.isString(options.destination)) {
- args.push("-d");
- args.push(options.destination);
+ args.push("-d " + options.destination);
}
if (_.isString(options.hostname)) {
- args.push("-h");
- args.push(options.hostname);
+ args.push("-h " + options.hostname);
}
if (!_.isEmpty(options.numCopies) && _.isNumber(options.numCopies) && options.numCopies > 1) {
- args.push("-n");
- args.push(options.numCopies);
+ args.push("-n " + options.numCopies);
}
if (!_.isEmpty(options.priority) && _.isNumber(options.priority) && options.priority > 1) {
- args.push("-q");
- args.push(options.priority);
+ args.push("-q " + options.priority);
}
- if (_.isString(options.mediaSize)) {
- args.push("-o");
- args.push("mediaSize=" + options.mediaSize);
+ if (_.isString(options.media)) {
+ args.push("-o media=" + options.media);
}
- if (!_.isEmpty(options.fitPlot) && _.isBoolean(options.fitPlot) && options.fitPlot) {
- args.push("-o");
- args.push("fitPlot");
+ if (true === options.fitplot) {
+ args.push("-o fitplot");
}
return args;
@@ -86,7 +79,7 @@ module.exports.printFile = function (file, options, identifier) {
args.push ("--");
args.push (file);
-
+
var lp = spawn("lp", args);
return new Job(lp, identifier);

0 comments on commit 7993bf4

Please sign in to comment.