[Printing-architecture] Get all the job attributes
Deepak Patankar
patankardeepak04 at gmail.com
Fri Apr 5 08:31:22 UTC 2019
Hi
I want to get all the job attributes like Pagesize, PaperType, Paper source
for the job. I am using the following code to get that information.
static const char * const jattrs[] = /* Job attributes we want */
{
"job-template",
"job-description",
"all"
};
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", printer);
/* Getting the resource */
resource = uri + (strlen(uri) - strlen(printer) - 10);
http = http_connect_local();
request = ippNewRequest(IPP_OP_GET_JOB_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL,uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
"job-id",job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
(int)(sizeof(jattrs) / sizeof(jattrs[0])), NULL, jattrs);
response = cupsDoRequest(http, request,resource);
attr = ippFirstAttribute(response);
The output of the code is :
attributes-charset,utf-8
attributes-natural-language,en-in
number-of-documents,1
job-media-progress,0
job-more-info,http://localhost/jobs/103
job-printer-up-time,1553796490
job-printer-uri,ipp://localhost/printers/grp
job-uri,ipp://localhost/jobs/103
job-originating-user-name,deepak
printer-uri,ipp://localhost:631/printers/grp
job-name,ASL350_Assignment.pdf
number-up,1
PageSize,A4
*MediaType,Envelope*
Collate,false
job-priority,50
job-sheets,none,none
Duplex,None
document-format-detected,application/pdf
document-format,application/pdf
job-uuid,urn:uuid:e5aa7490-eb34-3200-6a64-7e43ca050a39
cups-browsed,true
job-originating-host-name,localhost
date-time-at-completed,no-value
date-time-at-creation,2019-03-28T18:08:10Z
date-time-at-processing,2019-03-28T18:08:10Z
time-at-completed,no-value
time-at-creation,1553796490
time-at-processing,1553796490
job-id,103
job-state,processing
job-state-reasons,job-printing
job-impressions-completed,0
job-media-sheets-completed,0
job-k-octets,51
job-hold-until,no-hold
1. The media-col attribute is not returned in the request. How I can change
the request to get media-col ?
2. The paper type is given as "MediaType Envelope", How I can get the
media-type from the response ? I tried:
if ((attr = ippFindAttribute(response, "MediaType",
IPP_TAG_KEYWORD)) != NULL && ippGetCount(attr)>0){
if ((attr = ippFindAttribute(response, "media-type",
IPP_TAG_KEYWORD)) != NULL && ippGetCount(attr)>0){
[image: Screenshot from 2019-03-28 23-15-00.png]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/printing-architecture/attachments/20190405/b5ca3444/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2019-03-28 23-15-00.png
Type: image/png
Size: 769412 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/printing-architecture/attachments/20190405/b5ca3444/attachment-0001.png>
More information about the Printing-architecture
mailing list