cupsFilter need to parse PPD file to get user options?

Michael Sweet mike at easysw.com
Mon Dec 20 17:01:13 PST 2004


anonymous wrote:
> I'm writing my own *cupsFilter. Do I have to parse both the ppd file
> and the user option list to support all user options?
> 
> After setting up queue options and print a test page, command line
> arguments #6 (options) to the filter is an empty list. So I suppose I
> have to parse PPD file to get options.
> 
> User might submit job through command line and overwrite options set
> in PPD file, so I have to parse that as well?
> 
> How about kprinter. I saw some strange options like
> orientation-requested=4 
> multiple-document-handling=separate-documents-collated-copies, how am
> I supposed to do with it?

The typical method is to use:

     ppd_file_t *ppd;
     int num_options;
     cups_option_t *options;

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

and then check ppdIsMarked() or ppdFindMarkedChoice() for any
PPD-based options and cupsGetOption() for any non-PPD options.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com




More information about the cups mailing list