Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
CUPS
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Filter system === [[File:CUPS-block-diagram.svg|200px|thumb|CUPS allows users to send different data to the CUPS server and have that data converted into a format the printer will understand and be able to print]] CUPS can process a variety of data formats on the print server. It converts the print-job data into the final language/format of the printer via a series of ''filters''.<ref name="filtersadmin">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Administrators Manual|url=http://www.cups.org/doc-1.1/sam.html#2_5|title=Filters|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070106145359/http://www.cups.org/doc-1.1/sam.html#2_5|archive-date=January 6, 2007}}</ref><ref name="filters_sdd">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Design|url=http://www.cups.org/doc-1.1/sdd.html#3_7|title=Filters|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070110180805/http://www.cups.org/doc-1.1/sdd.html#3_7|archive-date=January 10, 2007}}</ref> It uses [[Internet media type|MIME types]] for identifying file formats. ==== MIME databases ==== After the CUPS system has assigned the print job to the scheduler, it is passed to the CUPS filter system. This converts the data to a format suitable for the printer. During start-up, the CUPS daemon loads two MIME databases: <code>mime.types</code> that defines the known file types that CUPS can accept data for, and <code>mime.convs</code> that defines the programs that process each particular MIME type.<ref name="MIMEadmin">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Administrators Manual|url=http://www.cups.org/doc-1.1/sam.html#FILE_TYPING_FILTERING|title=File Typing and Filtering|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070106145359/http://www.cups.org/doc-1.1/sam.html#FILE_TYPING_FILTERING|archive-date=January 6, 2007}}</ref> The <code>mime.types</code> file has the syntax: <code>mimetype { [file-extensions] | [pattern-match] }</code> For example, to detect an [[HTML]] file, the following entry would be applicable: <code>text/html html htm \</code><br/> :<code>printable(0,1024) + (string(0,"<nowiki><HTML></nowiki>") string(0,"<!DOCTYPE"))</code> The second line matches the file contents to the specified MIME type by determining that the first kilobyte of text in the file holds printable characters and that those characters include HTML markup. If the pattern above matches, then the filter system would mark the file as the MIME type text/html.<ref name="mime_types">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Administrators Manual|url=http://www.cups.org/doc-1.1/sam.html#7_13_1|title=mime.types|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070106145359/http://www.cups.org/doc-1.1/sam.html#7_13_1|archive-date=January 6, 2007}}</ref> The <code>mime.convs</code> file has the syntax: <code>source destination cost program</code> The ''source'' field designates the MIME type that is determined by looking up the <code>mime.types</code> file, while the ''destination'' field lists the type of output requested and determines what program should be used. This is also retrieved from <code>mime.types</code>. The ''cost'' field assists in the selection of sets of filters when converting a file. The last field, ''program'', determines which filter program to use to perform the data conversion.<ref name="mime_convs">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Administrators Manual|url=http://www.cups.org/doc-1.1/sam.html#7_13_Γ©|title=mime.convs|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070106145359/http://www.cups.org/doc-1.1/sam.html#7_13_Γ©|archive-date=January 6, 2007}}</ref> Some examples: text/plain application/postscript 50 texttops application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster image/* application/vnd.cups-postscript 50 imagetops image/* application/vnd.cups-raster 50 imagetoraster ==== Filtering process ==== The filtering process works by taking input data pre-formatted with six arguments: # the job ID of the print job # the user name # the job name # the number of copies to print # any print options # the filename (though this is unnecessary if it has been redirected from [[standard input]]).<ref name="filters_sdd"/> It then determines the type of data that is being input and the filter to be used through the use of the MIME databases; for instance, image data will be detected and processed through a particular filter, and HTML data detected and processed through another filter. CUPS can convert supplied data either into [[PostScript]] data or directly into raster data. If it is converted into PostScript data an additional filter is applied called a ''prefilter'', which runs the PostScript data through another PostScript converter so that it can add printer-specific options like selecting page ranges to print, setting ''n''-up mode and other device-specific things.<ref name="pstops">{{cite web|work=[[Easy Software Products]]|publisher=CUPS Software Administrators Manual|url=http://www.cups.org/doc-1.1/sdd.html#3_7_5|title=pstops|access-date=January 9, 2007|url-status=dead|archive-url=https://web.archive.org/web/20070110180805/http://www.cups.org/doc-1.1/sdd.html#3_7_5|archive-date=January 10, 2007}}</ref> After the pre-filtering is done, the data can either be sent directly to a CUPS [[#Backends|backend]] if using a PostScript printer, or it can be passed to another filter like [[Foomatic]] by [[linuxprinting.org]]. Alternatively, it can be passed to [[Ghostscript]], which converts the PostScript into an intermediary ''CUPS-raster'' format.<ref name="cups-raster MIME type">The MIME type for the CUPS raster format is application/vnd.cups-raster.</ref> The intermediary raster format is then passed onto a final filter which converts the raster data to a printer-specific format. The default filters included with CUPS include: * raster to [[Printer Command Language|PCL]] * raster to [[ESC/P]] or [[ESC/P2]] (an [[Epson]] printer language, now largely superseded by their new ESC/P-Raster format) * raster to [[Dymo]] (another printer company). * raster to Zebra Programming Language or ZPL (a [[Zebra Technologies]] printer language) {{As of | 2009}} other proprietary languages like GDI or SPL (Samsung Printer Language) are supported by Splix, a raster to SPL translator.<ref>{{Cite web|url=http://splix.sourceforge.net/|title=SPL driver for UNIX|website=splix.sourceforge.net}}</ref> However, several other alternatives can integrate with CUPS. [[HPLIP]] (previously known as HP-IJS) provides Linux+CUPS drivers for HP printers, [[Gutenprint]] (previously known as Gimp-Print) is a range of high-quality printer drivers for (mostly) inkjet printers, and [[TurboPrint]] for Linux has another range of quality printer drivers for a wide range of printers.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)