Set printer options

Michael Sweet mike at easysw.com
Mon Dec 15 07:53:21 PST 2008


shermin wrote:
> Hi,
> 
>   If i made changes to "set printer options"   after adding the printer and when i asked to print the argv[5] value is not updating.It is getting the value from .ppd file.If we made any changes in the printer options that should be updated right.How will we get those changed values .?

 From the PPD file or from the page header values...

If the PPD code does not set a page header value, use the following
to lookup the currently set PPD option:

     ppd_file_t *ppd = ppdOpenFile(getenv("PPD"));
     ppd_choice_t *marked;
     int num_options;
     cups_option_t *options;

     num_options = cupsParseOptions(argv[5], 0, &options);
     ppdMarkDefaults(ppd);
     cupsMarkOptions(ppd, num_options, options);

     ...

     // Which choice for "Foo" is selected? (Note, can return NULL!)
     choice = ppdFindMarkedChoice(ppd, "Foo");
     if (choice != NULL && strcmp(choice->choice, "Bar") == 0)
     {
       // Foo=Bar is chosen!
     }

(Options that use PostScript code to set page header values can be used
  to do per-page settings, while PPD-only settings apply to the whole
  document/job...)

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com




More information about the cups mailing list