Re: cups raw mode, was Re: [Samba] unlink data file in cups_job_submit
On 21 Sep 2002, Paul Janzen wrote: > If I am using native printer drivers on Windows clients, I would like > the "raw" option to get propagated to CUPS. Otherwise cups does not > pass the data on to the printer. (If I enable cups's application/ > octet-stream raw-data passthrough feature, both cupsomatic and the > Windows driver add PJL headers and footers, which is not what I want > either.) ... > The result is that to support both unix printing and native-driver > Windows printing from CUPS, you have to have two logical printers per > physical printer: one ("cooked") for Unix clients and one ("raw") for > Samba to use. OK. I like the patch but am hesitant to add more parameters. Too late to add this for 2.2.6. I 'll look at merging it for 3.0. cheers, jerry -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba
CUPS filtering mechanism explained, was: [cups raw mode, was Re: [Samba] unlink data file in cups_job_submit]
Paul Janzen wrote on Samba digest: > Message: 7 > To: Gerald Carter <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > From: Paul Janzen <[EMAIL PROTECTED]> > Subject: cups raw mode, was Re: [Samba] unlink data file in cups_job_submit > Date: 21 Sep 2002 12:09:23 -0700 > > > Gerald Carter <[EMAIL PROTECTED]> writes: > > > Looks right to me [:-)] Applying it now. Thanks. I've been meaning to > > track this one down. > > > Thanks! > > While we are on the subject... [:-)] > > If I am using native printer drivers on Windows clients, I would like > the "raw" option to get propagated to CUPS. Otherwise cups does not > pass the data on to the printer. Paul, I see you know about what you call the "raw data passthrough feature". I guess you mean the lines in "/etc/cups/mime.types" and "/etc/cups/mime.convs" which need to be uncommented to allow "raw" printing ? Here is some clarification (likely not very useful for you, but possibly for some other readers of the Samba list): ### If you have "printing = cups" and "printcap = cups" enabled, --- everything is handled by Samba accessing the CUPS API. (And any "print command" directive in Samba will be ignored.) If the CUPS API is not available (because Samba might not be compiled against libcups), it automatically maps to the "System V" command set, with "-oraw" enabled automatically. > (If I enable cups's application/ > octet-stream raw-data passthrough feature, both cupsomatic and the > Windows driver add PJL headers and footers, which is not what I want > either.) ### According to my experience, cupsomatic on the Samba/CUPS server --- does *not* add any features if a file is really printed "raw". However, if you have loaded the driver for the Windows client from the CUPS server, using the "cupsaddsmb" utility, and if this driver is one using a "Foomatic" PPD, the PJL header in question is already added on the Windows client, at the time when the driver initially generated the PostScript data -- and CUPS in true "-oraw" manner doesn't remove this PJL header and passes the file "as is" to its printer communication backend. NOTE, please, that the editing in the "mime.convs" and the - "mime.types" file does not *enforce* "raw" printing, it only *allows* it. Any file arriving from Windows is "auto-typed" by CUPS, which might consecutively lead to its treatment by various filters automatically (depending on the actual outcome of the auto-typing and the configuration of the printqueue in question): --> Files generated by PCL drivers and destined to PCL printers get auto-typed "application/octet-stream" and are indeed printed "raw". Also, unknown file types are getting tagged as "application/octet-stream". --> Files generated by a PostScript driver (and destined for any target printer type) are auto-typed. Depending on the driver, the discovered MIME type may be * application/postscript or * application/vnd.cups-postscript "application/postscript" goes first thru the "pstops" filter (where also the page counting and accounting takes place currently), and the outcome will be of MIME type "application/vnd.cups-postscript". The pstopsfilter reads and uses information from the PPD and inserts user-provided options into the PostScript file. As a consequence, the filtered file will possibly have the PJL header you don't want. "application/postscript" will be all files with a ".ps", ".ai", ".eps" suffix or which have as their first character string one of "%!" or "<04>%". "application/vnd.cups-postscript" will be those files which do both, first... ...carry a string "LANGUAGE=POSTSCRIPT" (or similar variations with different capitalization) amongst the first 512 bytes, *plus*... ...contain the "PJL super escape code" amongst the first 128 bytes ("<1B>%-12345X"). Very likely, most PostScript files generated on Windows using a CUPS- or other PPD, will have to be auto-typed as "vnd.cups-postscript". Probably a file produced with a "Generic PostScript driver" will be just "application/postscript" (have not checked). Once the file is in "application/vnd.cups-postscript" format, either "pstoraster" or "cupsomatic" will take over (depending on the printer configuration, as determined by the PPD in use). NOTE:
cups raw mode, was Re: [Samba] unlink data file in cups_job_submit
Gerald Carter <[EMAIL PROTECTED]> writes: > Looks right to me :-) Applying it now. Thanks. I've been meaning to > track this one down. Thanks! While we are on the subject... :-) If I am using native printer drivers on Windows clients, I would like the "raw" option to get propagated to CUPS. Otherwise cups does not pass the data on to the printer. (If I enable cups's application/ octet-stream raw-data passthrough feature, both cupsomatic and the Windows driver add PJL headers and footers, which is not what I want either.) With traditional lpr, you can just add "-oraw" to the "print command" line in smb.conf. With cups, you don't have that alternative. The result is that to support both unix printing and native-driver Windows printing from CUPS, you have to have two logical printers per physical printer: one ("cooked") for Unix clients and one ("raw") for Samba to use. The attached patch allows you to specify an option string for cups printers in smb.conf. So, if you want to use native Windows drivers, all you need is cups printer options = raw in smb.conf. You can add any other options that cups and the printer understand. --- samba-2.2.5/source/printing/print_cups.c.cups Thu May 2 18:03:31 2002 +++ samba-2.2.5/source/printing/print_cups.cSat Sep 21 10:35:20 2002 @@ -582,6 +582,8 @@ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ cups_lang_t *language; /* Default language */ + cups_option_t *options; + int num_options; charuri[HTTP_MAX_URI]; /* printer-uri attribute */ @@ -639,6 +641,17 @@ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, pjob->jobname); + + /* + * Add Samba-specific CUPS options + */ + options = (cups_option_t *)NULL; + num_options = 0; + + num_options = cupsParseOptions(lp_cupsprinteroptions(snum), + num_options, &options); + cupsEncodeOptions(request, num_options, options); + cupsFreeOptions(num_options, options); /* * Do the request and get back a response... --- samba-2.2.5/source/param/loadparm.c~Tue Jun 18 18:13:45 2002 +++ samba-2.2.5/source/param/loadparm.c Sat Sep 21 10:27:51 2002 @@ -320,6 +320,7 @@ char *szLpresumecommand; char *szQueuepausecommand; char *szQueueresumecommand; + char *szCupsPrinterOptions; char *szPrintername; char *szPrinterDriver; char *szPrinterDriverLocation; @@ -441,6 +442,7 @@ NULL, /* szLpresumecommand */ NULL, /* szQueuepausecommand */ NULL, /* szQueueresumecommand */ + NULL, /* szCupsPrinterOptions */ NULL, /* szPrintername */ NULL, /* szPrinterDriver - this is set in init_globals() */ NULL, /* szPrinterDriverLocation */ @@ -911,6 +913,7 @@ {"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, {"queuepause command", P_STRING, P_LOCAL, &sDefault.szQueuepausecommand, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, {"queueresume command", P_STRING, P_LOCAL, &sDefault.szQueueresumecommand, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, + {"cups printer options", P_STRING, P_LOCAL, &sDefault.szCupsPrinterOptions, +NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, {"enumports command", P_STRING, P_GLOBAL, &Globals.szEnumPortsCommand, NULL, NULL, 0}, {"addprinter command", P_STRING, P_GLOBAL, &Globals.szAddPrinterCommand, NULL, NULL, 0}, @@ -1119,6 +1122,7 @@ { string_set(&sDefault.szPrinterDriver, ""); string_set(&sDefault.szDriverFile, DRIVERFILE); + string_set(&sDefault.szCupsPrinterOptions, ""); /* choose defaults depending on the type of printing */ switch (sDefault.iPrinting) @@ -1714,6 +1718,7 @@ FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand) FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand) FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand) +FN_LOCAL_STRING(lp_cupsprinteroptions, szCupsPrinterOptions) static FN_LOCAL_STRING(_lp_printername, szPrintername) FN_LOCAL_STRING(lp_driverfile, szDriverFile) FN_LOCAL_STRING(lp_printerdriver, szPrinterDriver) -- Paul -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba