[cups.bugs] ppdMarkOption and ppdFindMarkedChoice

Michael R Sweet msweet at apple.com
Wed Aug 22 08:52:35 PDT 2007

shilpi wrote:
> hi
>  m facing problem while marking the options for the printer in the ppd file.
> the problem is : if u do ppdMarkOption(ppd, "PageSize","A4");
>     and then    ppdMarkOption(ppd, "PageRegion","A4");
>   then if u query for
>     ppd_choice_t *choice = ppdFindMarkedChoice(ppd,"PageSize");
>   it will return NULL.
> This is because as soon as u mark the choice for PageRegion, the choice for PageSize get unmarked.
> Is this a bug in cups or m i doing something wrong ??

You are doing something wrong.

In general, PageRegion is used when the InputSlot or ManualFeed
options are set, while PageSize is used when they are not set.

Because PageSize and PageRegion are handled differently than
other options, I recommend using ppdPageSize(ppd, NULL) to get
the currently selected page size.  If you really need to get
the choice (and thus the PS code) for the current page size,
try getting the marked PageSize and if that returns NULL get
the marked PageRegion choice instead.

Michael R Sweet                        Senior Printing System Engineer

More information about the cups-devel mailing list