From: Michael R Sweet Date: Fri, 17 May 2019 14:02:27 +0000 (-0400) Subject: Normalize ippeveprinter environment with ippserver: X-Git-Tag: v2.3rc1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef4d439c3bc3a9ffcfe103a3d76cd82ae66873c1;p=thirdparty%2Fcups.git Normalize ippeveprinter environment with ippserver: - Add -F option to specify the output format (default is application/postscript when PPDs are used) - Add pwg-xxx attributes and output format to environment. --- diff --git a/doc/help/man-ippeveprinter.html b/doc/help/man-ippeveprinter.html index ec25dabc0f..d37d635596 100644 --- a/doc/help/man-ippeveprinter.html +++ b/doc/help/man-ippeveprinter.html @@ -23,6 +23,9 @@ ippeveprinter - an ipp everywhere printer application for cups -D device-uri ] [ +-F +output-type/subtype +] [ -K keypath ] [ @@ -94,6 +97,9 @@ The URI can be a filename, directory, or a network socket URI of the form "socke When specifying a directory, ippeveprinter will create an output file using the job ID and name. +
-F output-type/subtype[,...] +
Specifies the output MIME media type. +The default is "application/postscript" when the -P option is specified.
-M manufacturer
Set the manufacturer of the printer. The default is "Example". @@ -169,12 +175,12 @@ program is unique to CUPS and conforms to the IPP Everywhere (PWG 5100.14) speci ippeveprinter adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. -

In addition, all IPP "xxx-default" Printer Description attributes are added to the environment. +

In addition, all IPP "xxx-default" and "pwg-xxx" Printer Description attributes are added to the environment. For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute.

Enumerated values are converted to their keyword equivalents. For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". -

Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option. +

Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, the "OUTPUT_FORMAT" environment variable contains the output MIME media type, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option.

Command Output

Unless they communicate directly with a printer, print commands send printer-ready data to the standard output.

Print commands can send messages back to @@ -213,6 +219,8 @@ command whenever a job is sent to the server: ippeveprinter -c /usr/bin/file "My Cool Printer"

See Also

+ippevepcl(7), +ippeveps(7), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp)

Copyright

Copyright © 2007-2019 by Apple Inc. diff --git a/man/ippeveprinter.1 b/man/ippeveprinter.1 index 3165400f2a..5753c69da6 100644 --- a/man/ippeveprinter.1 +++ b/man/ippeveprinter.1 @@ -6,7 +6,7 @@ .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH ippeveprinter 1 "CUPS" "3 May 2019" "Apple Inc." +.TH ippeveprinter 1 "CUPS" "17 May 2019" "Apple Inc." .SH NAME ippeveprinter \- an ipp everywhere printer application for cups .SH SYNOPSIS @@ -23,6 +23,9 @@ ippeveprinter \- an ipp everywhere printer application for cups .B \-D .I device-uri ] [ +.B \-F +.I output-type/subtype +] [ .B \-K .I keypath ] [ @@ -99,6 +102,10 @@ When specifying a directory, .B ippeveprinter will create an output file using the job ID and name. .TP 5 +\fB\-F \fIoutput-type/subtype[,...]\fR +Specifies the output MIME media type. +The default is "application/postscript" when the \fB\-P\fR option is specified. +.TP 5 \fB\-M \fImanufacturer\fR Set the manufacturer of the printer. The default is "Example". @@ -189,14 +196,14 @@ program is unique to CUPS and conforms to the IPP Everywhere (PWG 5100.14) speci adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. .LP -In addition, all IPP "xxx-default" Printer Description attributes are added to the environment. +In addition, all IPP "xxx-default" and "pwg-xxx" Printer Description attributes are added to the environment. For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute. .LP Enumerated values are converted to their keyword equivalents. For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". .LP -Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "\-D" option, and the "PPD" environment variable contains the PPD filename as specified with the "\-P" option. +Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "\-D" option, the "OUTPUT_FORMAT" environment variable contains the output MIME media type, and the "PPD" environment variable contains the PPD filename as specified with the "\-P" option. .SH COMMAND OUTPUT Unless they communicate directly with a printer, print commands send printer-ready data to the standard output. .LP @@ -242,6 +249,8 @@ command whenever a job is sent to the server: ippeveprinter \-c /usr/bin/file "My Cool Printer" .fi .SH SEE ALSO +.BR ippevepcl (7), +.BR ippeveps (7), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) .SH COPYRIGHT Copyright \[co] 2007-2019 by Apple Inc. diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index 954b910d05..3fce71594c 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -172,6 +172,7 @@ typedef struct ippeve_printer_s /**** Printer data ****/ *hostname, /* Hostname */ *uri, /* printer-uri-supported */ *device_uri, /* Device URI (if any) */ + *output_format, /* Output format */ #if !CUPS_LITE *ppdfile, /* PPD file (if any) */ #endif /* !CUPS_LITE */ @@ -243,7 +244,7 @@ static int create_job_file(ippeve_job_t *job, char *fname, size_t fnamesize, co static int create_listener(const char *name, int port, int family); static ipp_t *create_media_col(const char *media, const char *source, const char *type, int width, int length, int bottom, int left, int right, int top); static ipp_t *create_media_size(int width, int length); -static ippeve_printer_t *create_printer(const char *servername, int serverport, const char *name, const char *location, const char *icon, cups_array_t *docformats, const char *subtypes, const char *directory, const char *command, const char *device_uri, ipp_t *attrs); +static ippeve_printer_t *create_printer(const char *servername, int serverport, const char *name, const char *location, const char *icon, cups_array_t *docformats, const char *subtypes, const char *directory, const char *command, const char *device_uri, const char *output_format, ipp_t *attrs); static void debug_attributes(const char *title, ipp_t *ipp, int response); static void delete_client(ippeve_client_t *client); static void delete_job(ippeve_job_t *job); @@ -330,6 +331,7 @@ main(int argc, /* I - Number of command-line args */ *attrfile = NULL, /* ippserver attributes file */ *command = NULL, /* Command to run with job files */ *device_uri = NULL, /* Device URI */ + *output_format = NULL, /* Output format */ *icon = NULL, /* Icon file */ #ifdef HAVE_SSL *keypath = NULL, /* Keychain path */ @@ -398,6 +400,14 @@ main(int argc, /* I - Number of command-line args */ device_uri = argv[i]; break; + case 'F' : /* -F output/format */ + i ++; + if (i >= argc) + usage(1); + + output_format = argv[i]; + break; + #ifdef HAVE_SSL case 'K' : /* -K keypath */ i ++; @@ -647,12 +657,15 @@ main(int argc, /* I - Number of command-line args */ if (!command) command = "ippeveps"; + + if (!output_format) + output_format = "application/postscript"; } #endif /* !CUPS_LITE */ else attrs = load_legacy_attributes(make, model, ppm, ppm_color, duplex, docformats); - if ((printer = create_printer(servername, serverport, name, location, icon, docformats, subtypes, directory, command, device_uri, attrs)) == NULL) + if ((printer = create_printer(servername, serverport, name, location, icon, docformats, subtypes, directory, command, device_uri, output_format, attrs)) == NULL) return (1); printer->web_forms = web_forms; @@ -1241,6 +1254,7 @@ create_printer( const char *directory, /* I - Spool directory */ const char *command, /* I - Command to run on job files, if any */ const char *device_uri, /* I - Output device, if any */ + const char *output_format, /* I - Output format, if any */ ipp_t *attrs) /* I - Capability attributes */ { ippeve_printer_t *printer; /* Printer */ @@ -1479,6 +1493,7 @@ create_printer( printer->dnssd_name = strdup(name); printer->command = command ? strdup(command) : NULL; printer->device_uri = device_uri ? strdup(device_uri) : NULL; + printer->output_format = output_format ? strdup(output_format) : NULL; printer->directory = strdup(directory); printer->icon = icon ? strdup(icon) : NULL; printer->port = serverport; @@ -6023,6 +6038,12 @@ process_job(ippeve_job_t *job) /* I - Job */ myenvp[myenvc ++] = strdup(val); } + if (job->printer->output_format) + { + snprintf(val, sizeof(val), "OUTPUT_TYPE=%s", job->printer->output_format); + myenvp[myenvc ++] = strdup(val); + } + #if !CUPS_LITE if (job->printer->ppdfile) { @@ -6035,7 +6056,7 @@ process_job(ippeve_job_t *job) /* I - Job */ { /* * Convert "attribute-name-default" to "IPP_ATTRIBUTE_NAME_DEFAULT=" and - * then add the value(s) from the attribute. + * "pwg-xxx" to "IPP_PWG_XXX", then add the value(s) from the attribute. */ const char *name = ippGetName(attr), @@ -6043,7 +6064,7 @@ process_job(ippeve_job_t *job) /* I - Job */ *suffix = strstr(name, "-default"); /* Suffix on attribute name */ - if (!suffix || suffix[8]) + if (strncmp(name, "pwg-", 4) && (!suffix || suffix[8])) continue; valptr = val; @@ -7646,6 +7667,7 @@ usage(int status) /* O - Exit status */ _cupsLangPuts(stderr, _("--version Show program version")); _cupsLangPuts(stdout, _("-2 Set 2-sided printing support (default=1-sided)")); _cupsLangPuts(stdout, _("-D device-uri Set the device URI for the printer")); + _cupsLangPuts(stdout, _("-F output-type/subtype Set the output format for the printer")); #ifdef HAVE_SSL _cupsLangPuts(stdout, _("-K keypath Set location of server X.509 certificates and keys.")); #endif /* HAVE_SSL */