[cups.general] How to get media size of current job?
Michael Sweet
msweet at apple.com
Fri Dec 11 08:32:13 PST 2009
On Dec 11, 2009, at 6:06 AM, Lu binbin wrote:
> Hi,
> I need to get the media or paper size of current print job in my work.
> In RFC 2911, I found there is a media attribute in Job Template Attribute. So I use pkipplib parse some control file (/var/spool/cups/cxxxxx),there are only Operation attributes and Job attributes.
>
> How can i get media size of current job? Thanks!
Are you doing this from a filter? If so, the correct way is to combine the options from argv[5] with the PPD defaults, and then query the current size using ppdPageSize:
ppd_file_t *ppd = ppdOpenFile(getenv("PPD"));
cups_option_t *options = NULL;
int num_options = cupsParseOptions(argv[5], 0, &options);
ppd_size_t *size;
ppdMarkDefaults(ppd);
cupsMarkOptions(ppd, num_options, options);
size = ppdPageSize(ppd, NULL);
___________________________________________________
Michael Sweet, Senior Printing System Engineer
More information about the cups
mailing list