]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support standard PPD, PWG, and legacy names for media/PageSize regardless of the...
authorMichael R Sweet <msweet@msweet.org>
Mon, 4 May 2026 20:18:44 +0000 (16:18 -0400)
committerMichael R Sweet <msweet@msweet.org>
Mon, 4 May 2026 20:18:44 +0000 (16:18 -0400)
CHANGES.md
cups/ppd-mark.c

index 14c10b2fdb5d7d189875ecbd520b047d338ddaec..ce21046fe419fc9fdf3ca7a4f7c17fc53d3f266e 100644 (file)
@@ -167,6 +167,8 @@ v2.5b1 - YYYY-MM-DD
 - Fixed unreachable block in IPP backend (Issue #1351)
 - Fixed memory leak in `_cupsConvertOptions()` (Issue #1354)
 - Fixed missing write check in `cupsFileOpen/Fd` (Issue #1360)
+- Fixed mapping of standard PPD/PWG/legacy media size names to the local PPD
+  size name (Issue #1375)
 - Fixed error recovery when scanning for PPDs in `cups-driverd` (Issue #1416)
 - Fixed allowed values for directive `FilterNice`
 - Fixed an allocation bug in the `rastertoepson` filter (Issue #1537)
index 3e1a5968bf87b4b181151f3e22a8f838db407595..ac7cf8465f8e8a450caab7d4881f520c3a0263b7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Option marking routines for CUPS.
  *
- * Copyright © 2020-2025 by OpenPrinting.
+ * Copyright © 2020-2026 by OpenPrinting.
  * Copyright © 2007-2019 by Apple Inc.
  * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
@@ -793,6 +793,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
 
   cupsArraySave(ppd->options);
 
+  if (!_cups_strcasecmp(option, "media") || !_cups_strcasecmp(option, "media-col"))
+    option = "PageSize";
+
   o = ppdFindOption(ppd, option);
 
   cupsArrayRestore(ppd->options);
@@ -811,7 +814,7 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
     if ((c = ppdFindChoice(o, "Custom")) == NULL)
       return;
 
-    if (!_cups_strcasecmp(option, "PageSize"))
+    if (!_cups_strcasecmp(option, "PageRegion") || !_cups_strcasecmp(option, "PageSize"))
     {
      /*
       * Handle custom page sizes...
@@ -889,6 +892,34 @@ ppd_mark_option(ppd_file_t *ppd,   /* I - PPD file */
 
     choice = "Custom";
   }
+  else if (!_cups_strcasecmp(option, "PageRegion") || !_cups_strcasecmp(option, "PageSize"))
+  {
+   /*
+    * Handle page sizes as PPD, legacy, or PWG names...
+    */
+
+    ppd_size_t *ppdsize;               /* PPD size */
+
+    if ((ppdsize = ppdPageSize(ppd, choice)) == NULL)
+    {
+     /*
+      * Not a PPD size name, look it up...
+      */
+
+      const char *pagesize;            /* PPD PageSize choice */
+
+      if ((pagesize = _ppdCacheGetPageSize(ppd->cache, /*job*/NULL, choice, /*exact*/NULL)) != NULL)
+        ppdsize = ppdPageSize(ppd, pagesize);
+    }
+
+    if (!ppdsize)
+      return;
+
+    choice = ppdsize->name;
+
+    if ((c = ppdFindChoice(o, choice)) == NULL)
+      return;
+  }
   else if (choice[0] == '{')
   {
    /*