[cups-devel] How to get a list of (or default) page size?

Michael Sweet msweet at apple.com
Wed May 7 08:13:41 PDT 2014


Olivier,

I'm not aware of any issues with this API.  Can you file a bug on CUPS.org for this:

    https://www.cups.org/str.php

Also, it would be helpful if you tested using the current stable release of CUPS (1.7.2) rather than a release candidate...

Thanks!


On May 7, 2014, at 3:43 AM, Olivier Guillion - Myriad <olivier at myriad-online.com> wrote:

> Hi,
> 
> I'm working on Ubuntu 13.10, using cups 1.7rc1.
> 
> I would want to get the dimension and margin of the supported page size for 
> each printer (or at least the default one). Because the PPD API is marked as 
> deprecated, I'm trying not to use it.
> 
> Here is where I am, after 10 hours of struggle (in plain C):
> ------------
> num_dests= cupsGetDests(&dests);
> for (i=0,dest=dests;i<num_dests;i++,dest++)
>    {
>    http=cupsConnectDest(dest,CUPS_DEST_FLAGS_NONE,5000,
>                      &cancel,resource,1023,NULL,NULL); // 5 sec timeout
>   dinfo=cupsCopyDestInfo(http,dest);
>  // trying to get all possible media
>   nbmedia=cupsGetDestMediaCount(http,dest,dinfo,CUPS_MEDIA_FLAGS_DEFAULT);
>   printf("%d medias\n",nbmedia);
>  // always get 0 !!
>   }
> ---------------
> 
> This code is a simplified version, in which error check has been removed but I 
> get a valid http_t pointer, as well as a valid dinfo.
> 
> If I replace CUPS_MEDIA_FLAGS_DEFAULT by CUPS_MEDIA_FLAGS_BORDERLESS (the 
> latter is the only one that provides a non-null number of media), I get 1215 
> media, with paper size of about 137 meters long. I don't own a printer for 
> football fields, I promise! :)
> 
> As a side note, 
> cupsGetDestMediaByName(http,dest,dinfo,"iso_a4_210x297mm",
>                     CUPS_MEDIA_FLAGS_DEFAULT,&size)
> gives the right size and margins, but I don't know how I can get the proper 
> default media name for the printer.
> 
> Thanks for any help you could provide,
> Olivier
> Olivier Guillion
> Myriad
> 26 rue Michel de Montaigne
> 31200 Toulouse 
> FRANCE
> --------      WebSite    -----------
> http://www.myriad-online.com
> Download here the latest version of our shareware programs, view the online 
> tutorials or get info about Myriad and its activities.
> ---------------------------------
> 
> _______________________________________________
> cups-devel mailing list
> cups-devel at cups.org
> https://www.cups.org/mailman/listinfo/cups-devel

_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair




More information about the cups-devel mailing list