thorsson_cups 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/cups.c +8 -2
- metadata +2 -2
data/ext/cups.c
CHANGED
@@ -110,9 +110,11 @@ static VALUE cups_print(VALUE self)
|
|
110
110
|
int job_id;
|
111
111
|
VALUE file = rb_iv_get(self, "@filename");
|
112
112
|
VALUE printer = rb_iv_get(self, "@printer");
|
113
|
+
VALUE url_path = rb_iv_get(self, "@url_path");
|
113
114
|
|
114
115
|
char *fname = RSTRING_PTR(file); // Filename
|
115
116
|
char *target = RSTRING_PTR(printer); // Target printer string
|
117
|
+
char *url = RSTRING_PTR(url_path); // Server URL address
|
116
118
|
|
117
119
|
VALUE job_options = rb_iv_get(self, "@job_options");
|
118
120
|
|
@@ -142,8 +144,12 @@ static VALUE cups_print(VALUE self)
|
|
142
144
|
cupsAddOption(iter_str, value_str, num_options++, &options);
|
143
145
|
}
|
144
146
|
|
145
|
-
|
146
|
-
|
147
|
+
if(NIL_P(url)) {
|
148
|
+
job_id = cupsPrintFile(target, fname, "rCups", num_options, options); // Do it. "rCups" should be the filename/path
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
job_id = cupsPrintFile2(url, target, fname, "rCups", num_options, options); // Do it. "rCups" should be the filename/path
|
152
|
+
}
|
147
153
|
cupsFreeOptions(num_options, options);
|
148
154
|
|
149
155
|
rb_iv_set(self, "@job_id", INT2NUM(job_id));
|