4 *resource; /* Resource path */
5 int port, /* Port number */
6 version, /* IPP version */
7 - job_id; /* Job ID for submitted job */
8 + job_id, /* Job ID for submitted job */
9 + get_job_attrs; /* Support Get-Job-Attributes? */
10 const char *job_name; /* Job name for submitted job */
11 http_encryption_t encryption; /* Use encryption? */
12 ipp_jstate_t job_state; /* Current job state */
14 ipp_attribute_t *printer_state; /* printer-state attribute */
15 ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
16 int create_job = 0, /* Does printer support Create-Job? */
17 + get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */
18 send_document = 0, /* Does printer support Send-Document? */
19 validate_job = 0; /* Does printer support Validate-Job? */
20 int copies, /* Number of copies for job */
21 @@ -1065,13 +1067,18 @@
23 else if (operations_sup->values[i].integer == IPP_SEND_DOCUMENT)
25 + else if (operations_sup->values[i].integer == IPP_GET_JOB_ATTRIBUTES)
30 + if (create_job && !send_document)
32 fputs("DEBUG: Printer supports Create-Job but not Send-Document.\n",
36 + update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
37 + "cups-ipp-missing-send-document");
43 monitor.version = version;
45 + monitor.get_job_attrs = get_job_attrs;
46 monitor.encryption = cupsEncryption();
47 monitor.job_state = IPP_JOB_PENDING;
48 monitor.printer_state = IPP_PRINTER_IDLE;
50 _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
53 + else if (ipp_status == IPP_DOCUMENT_FORMAT)
55 else if (ipp_status == IPP_FORBIDDEN ||
56 ipp_status == IPP_AUTHENTICATION_CANCELED)
59 * Wait for the job to complete...
62 - if (!job_id || !waitjob)
63 + if (!job_id || !waitjob || !get_job_attrs)
66 _cupsLangPrintFilter(stderr, "INFO", _("Waiting for job to complete."));
68 response = cupsDoRequest(http, request, resource);
69 ipp_status = cupsLastError();
71 - if (ipp_status == IPP_NOT_FOUND)
72 + if (ipp_status == IPP_NOT_FOUND || ipp_status == IPP_NOT_POSSIBLE)
75 * Job has gone away and/or the server has no job history...
79 if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
80 - ipp_status != IPP_NOT_POSSIBLE &&
81 ipp_status != IPP_PRINTER_BUSY)
84 @@ -1865,12 +1874,18 @@
85 return (CUPS_BACKEND_AUTH_REQUIRED);
86 else if (ipp_status == IPP_INTERNAL_ERROR)
87 return (CUPS_BACKEND_STOP);
88 - else if (ipp_status == IPP_DOCUMENT_FORMAT ||
89 - ipp_status == IPP_CONFLICT)
90 + else if (ipp_status == IPP_CONFLICT)
91 return (CUPS_BACKEND_FAILED);
92 - else if (ipp_status == IPP_REQUEST_VALUE)
93 + else if (ipp_status == IPP_REQUEST_VALUE ||
94 + ipp_status == IPP_DOCUMENT_FORMAT || job_canceled < 0)
96 - _cupsLangPrintFilter(stderr, "ERROR", _("Print job too large."));
97 + if (ipp_status == IPP_REQUEST_VALUE)
98 + _cupsLangPrintFilter(stderr, "ERROR", _("Print job too large."));
99 + else if (ipp_status == IPP_DOCUMENT_FORMAT)
100 + _cupsLangPrintFilter(stderr, "ERROR",
101 + _("Printer cannot print supplied content."));
103 + _cupsLangPrintFilter(stderr, "ERROR", _("Print job canceled at printer."));
104 return (CUPS_BACKEND_CANCEL);
106 else if (ipp_status > IPP_OK_CONFLICT && ipp_status != IPP_ERROR_JOB_CANCELED)
107 @@ -2116,7 +2131,8 @@
108 * Check the status of the job itself...
111 - job_op = monitor->job_id > 0 ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
112 + job_op = (monitor->job_id > 0 && monitor->get_job_attrs) ?
113 + IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
114 request = ippNewRequest(job_op);
115 request->request.op.version[0] = monitor->version / 10;
116 request->request.op.version[1] = monitor->version % 10;
117 @@ -2306,7 +2322,7 @@
118 fprintf(stderr, "DEBUG: job-name=\"%s\"\n", title);
122 + if (format && op != IPP_CREATE_JOB)
124 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
125 "document-format", NULL, format);
126 @@ -2314,7 +2330,7 @@
131 + if (compression && op != IPP_CREATE_JOB)
133 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
134 "compression", NULL, compression);
135 --- a/scheduler/printers.c
136 +++ b/scheduler/printers.c
137 @@ -4233,6 +4233,41 @@
141 + * media-size-supported
144 + num_media = p->pc->num_sizes;
145 + if (p->pc->custom_min_keyword)
148 + if ((attr = ippAddCollections(p->ppd_attrs, IPP_TAG_PRINTER,
149 + "media-size-supported", num_media,
152 + val = attr->values;
154 + for (i = p->pc->num_sizes, pwgsize = p->pc->sizes;
156 + i --, pwgsize ++, val ++)
158 + val->collection = ippNew();
159 + ippAddInteger(val->collection, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
160 + "x-dimension", pwgsize->width);
161 + ippAddInteger(val->collection, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
162 + "y-dimension", pwgsize->length);
165 + if (p->pc->custom_min_keyword)
167 + val->collection = ippNew();
168 + ippAddRange(val->collection, IPP_TAG_PRINTER, "x-dimension",
169 + p->pc->custom_min_width, p->pc->custom_max_width);
170 + ippAddRange(val->collection, IPP_TAG_PRINTER, "y-dimension",
171 + p->pc->custom_min_length, p->pc->custom_max_length);
176 * media-source-supported
179 @@ -5145,6 +5180,8 @@
180 message = "Printer does not support REQUIRED Validate-Job operation.";
181 else if (!strcmp(reason, "missing-get-printer-attributes"))
182 message = "Printer does not support REQUIRED Get-Printer-Attributes operation.";
183 + else if (!strcmp(reason, "missing-send-document"))
184 + message = "Printer supports Create-Job but not Send-Document operation.";
185 else if (!strcmp(reason, "missing-job-history"))
186 message = "Printer does not provide REQUIRED job history.";
187 else if (!strcmp(reason, "missing-job-id"))