All of lore.kernel.org
 help / color / mirror / Atom feed
* [Printing-architecture] Get all the job attributes
@ 2019-04-05  8:31 Deepak Patankar
  2019-04-15 16:25 ` Michael Sweet
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak Patankar @ 2019-04-05  8:31 UTC (permalink / raw)
  To: printing-architecture


[-- Attachment #1.1: Type: text/plain, Size: 2641 bytes --]

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]

[-- Attachment #1.2: Type: text/html, Size: 3679 bytes --]

[-- Attachment #2: Screenshot from 2019-03-28 23-15-00.png --]
[-- Type: image/png, Size: 769412 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Printing-architecture] Get all the job attributes
  2019-04-05  8:31 [Printing-architecture] Get all the job attributes Deepak Patankar
@ 2019-04-15 16:25 ` Michael Sweet
  2019-04-28 19:18   ` Deepak Patankar
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Sweet @ 2019-04-15 16:25 UTC (permalink / raw)
  To: Deepak Patankar; +Cc: printing-architecture

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Deepak,

> On Apr 5, 2019, at 4:31 AM, Deepak Patankar <patankardeepak04@gmail.com> wrote:
> ...
> 1. The media-col attribute is not returned in the request. How I can change the request to get media-col ?

It will only be returned if it was sent in the original print request.  Currently we do not synthesize IPP attributes when the Job is created, just when it gets sent to an IPP printer.

If you'd like us to do so, please file a bug at:

    https://github.com/apple/cups/issues <https://github.com/apple/cups/issues>

Thanks!

> 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){

MediaType (like all PPD options sent as attributes) will have the IPP_TAG_NAME syntax.

>              if ((attr = ippFindAttribute(response, "media-type", 
>         IPP_TAG_KEYWORD)) != NULL && ippGetCount(attr)>0){

while "media-type" (the IPP attribute) can be IPP_TAG_NAME or IPP_TAG_KEYWORD, so here I'd usually look for IPP_TAG_ZERO and check for a NULL string value (which would indicate something that is not a name or keyword).

_________________________________________________________
Michael Sweet, Senior Printing System Engineer


[-- Attachment #2: Type: text/html, Size: 3846 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Printing-architecture] Get all the job attributes
  2019-04-15 16:25 ` Michael Sweet
@ 2019-04-28 19:18   ` Deepak Patankar
  0 siblings, 0 replies; 3+ messages in thread
From: Deepak Patankar @ 2019-04-28 19:18 UTC (permalink / raw)
  To: Michael Sweet; +Cc: printing-architecture

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]

On Mon 15 Apr, 2019, 9:59 PM Michael Sweet <msweet@apple.com wrote:

> Deepak,
>
> On Apr 5, 2019, at 4:31 AM, Deepak Patankar <patankardeepak04@gmail.com>
> wrote:
> ...
> 1. The media-col attribute is not returned in the request. How I can
> change the request to get media-col ?
>
>
> It will only be returned if it was sent in the original print request.
> Currently we do not synthesize IPP attributes when the Job is created, just
> when it gets sent to an IPP printer.
>
> If you'd like us to do so, please file a bug at:
>
>     https://github.com/apple/cups/issues
>
> Thanks!
>
> 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){
>
>
> MediaType (like all PPD options sent as attributes) will have the
> IPP_TAG_NAME syntax.
>
>              if ((attr = ippFindAttribute(response, "media-type",
>         IPP_TAG_KEYWORD)) != NULL && ippGetCount(attr)>0){
>
>
> while "media-type" (the IPP attribute) can be IPP_TAG_NAME or
> IPP_TAG_KEYWORD, so here I'd usually look for IPP_TAG_ZERO and check for a
> NULL string value (which would indicate something that is not a name or
> keyword).
>

Sir Thanks for the reply. My problem is solved. But, I also want to see
> what "orientation" and "multiple-document-handling" was selected by the
> user for the job. The data is not present in the response message. How can
> I get this information about the job?
>
> Thanks
> Deepak
> _________________________________________________________
> Michael Sweet, Senior Printing System Engineer
>
>

[-- Attachment #2: Type: text/html, Size: 4141 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-28 19:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05  8:31 [Printing-architecture] Get all the job attributes Deepak Patankar
2019-04-15 16:25 ` Michael Sweet
2019-04-28 19:18   ` Deepak Patankar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.