[Printing-architecture] names of paper sizes

Mignon Pelletier <[email protected]> Sun, 14 May 2023 15:04:38 -0700
Newsgroups dev.linux.lists.printing-architecture
Message-ID <[email protected]>
I'm confused about the many names that a paper size can have.

If I query my DYMO LabelWriter 450 Turbo with code like this:

         ipp_attribute_t *media =
             cupsFindDestSupported(CUPS_HTTP_DEFAULT, dest, info,
                                   CUPS_MEDIA);
         int i, count = ippGetCount(media);

         puts("media supported:");
         for (i = 0; i < count; i ++)
             printf("  %s\n", ippGetString(media, i, NULL));

Then I get names like this:

   custom_54.19x22.27mm_54.19x22.27mm
   custom_25.4x54.02mm_25.4x54.02mm
   custom_1x1in_1x1in
   custom_2.25x1.25in_2.25x1.25in
   custom_0.75x2in_0.75x2in
   custom_41.32x88.9mm_41.32x88.9mm

However, if I run "lpoptions -p LabelWriter-450-Turbo -l", I get names 
like this:

PageSize/Media Size: w154h64 w72h154 w72h72 w162h90 w54h144 w118h252
w167h188 w79h252 w167h252 *w167h288 w154h198 w82h248 w154h64.1
w79h252.1 w102h252 w154h286 w154h198.1 w54h424 w131h221 w57h248

I checked the source code for lpoptions, and it is using ppdOpenFile() 
and related functions, rather than cupsFindDestSupported().  I'm curious 
why these different APIs are returning different names for the paper 
sizes.  Also, my understanding is that the PPD functions are deprecated 
and are removed in CUPSv3?

Looking at LabelWriter-450-Turbo.ppd, the paper sizes are listed like this:

*PaperDimension w102h252/30321 Large Address: "101.28 251.04"
*PaperDimension w154h286/30323 Shipping: "153.12 285.84"
*PaperDimension w154h198.1/30324 Diskette: "153.12 198.00"
*PaperDimension w54h424/30325 Video Spine: "54.00 423.12"
*PaperDimension w131h221/30326 Video Top: "130.56 220.56"
*PaperDimension w57h248/30327 File Folder: "56.40 247.44"
*PaperDimension w54h144.1/30330 Return Address: "54.00 144.00"

I can see that the name before the slash is what is being returned by 
lpoptions.  However, what I really want is the name after the slash, 
such as "30330 Return Address", because this is by far the most 
human-readable.

So, my questions are:

1) Where are the names reported by cupsFindDestSupported() coming from?
2) How can I obtain the human-readable names, such as "30330 Return 
Address", preferably without using any deprecated APIs?

Thanks,

--Mignon