Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion cups/ppd-mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cupsMarkOptions(
s[255]; /* Temporary string */
const char *val, /* Pointer into value */
*media, /* media option */
*page_size, /* PageSize option */
*output_bin, /* output-bin option */
*ppd_keyword, /* PPD keyword */
*print_color_mode, /* print-color-mode option */
Expand All @@ -80,6 +81,7 @@ cupsMarkOptions(
*/

media = cupsGetOption("media", num_options, options);
page_size = cupsGetOption("PageSize", num_options, options);
output_bin = cupsGetOption("output-bin", num_options, options);
print_quality = cupsGetOption("print-quality", num_options, options);
sides = cupsGetOption("sides", num_options, options);
Expand All @@ -88,7 +90,7 @@ cupsMarkOptions(
options)) == NULL)
print_color_mode = cupsGetOption("output-mode", num_options, options);

if ((media || output_bin || print_color_mode || print_quality || sides) &&
if ((media || page_size || output_bin || print_color_mode || print_quality || sides) &&
!ppd->cache)
{
/*
Expand All @@ -100,6 +102,19 @@ cupsMarkOptions(

cache = ppd->cache;

if (page_size && *page_size && !ppdPageSize(ppd, page_size))
{
/*
* If PageSize value is missing from the PPD, assume PPD uses non-Adobe
* names and try to load the mapping from cache.
*
* Media has higher priority and may redefine PageSize later.
*/

if ((ppd_keyword = _ppdCacheGetPageSize(cache, NULL, page_size, NULL)) != NULL)
ppd_mark_option(ppd, "PageSize", ppd_keyword);
}

if (media)
{
/*
Expand Down
Loading