cupsfilter
Convert print files to different formats
SYNOPSIS
cupsfilter [ -E ] [ -U username ] [ -c config-file ] [ -d printer ] [ -e ] [ -f filter ] [ -i mimetype ] [ -m mimetype ] [ -o option=value ] [ -p filename ] [ -t title ] [ -u ] file
PARAMETERS
-E
Enables encryption (SSL/TLS) for connections to the CUPS scheduler.
-U username
Specifies the username to use when connecting to the scheduler.
-c config-file
Uses the specified cupsd.conf file for configuration, overriding the default.
-d printer
Specifies the destination printer for filtering. This is crucial for selecting the correct PPD and filter chain.
-e
Specifies that the output should be a raw print file, bypassing the final backend filter. Useful for direct printer data.
-f filter
Specifies an explicit filter program to use, bypassing the automatic filter chain determination.
-i mimetype
Specifies the input file's MIME type. This helps in accurate filter chain selection, especially for ambiguous files.
-m mimetype
Specifies the desired output MIME type for the filtered data.
-o option=value
Specifies job options (e.g., media=A4, print-quality=draft) that influence the filtering process.
-p filename
Specifies the PPD (PostScript Printer Description) file to use for filtering, simulating a specific printer's capabilities.
-t title
Specifies the job title for the filtering operation.
-u
Specifies that the output should be uncompressed, which is useful for debugging.
file
The input file to be processed. Use a hyphen (-) to read from standard input.
DESCRIPTION
cupsfilter is a command-line utility that is an integral part of the Common Unix Printing System (CUPS). Its primary function is to simulate the CUPS printing pipeline by processing an input file through the appropriate CUPS filters and outputting the resulting print-ready data to standard output.
This tool is invaluable for developers, administrators, and users who need to test CUPS filters, debug printing issues, or simply convert a document into a format suitable for a printer without actually sending it to a physical device. It determines the correct filter chain based on the input file's MIME type, the specified printer, and any provided options, just as the CUPS scheduler would.
The output can range from PostScript to PCL or even raw printer data, depending on the chosen printer's PPD file and the desired output MIME type. By allowing explicit specification of input/output MIME types, filters, and printer PPDs, cupsfilter offers granular control over the conversion process, making it a powerful utility for pre-press preparation or system diagnostics.
CAVEATS
- cupsfilter mimics the CUPS filtering process but does not interact with actual printer backends or network queues. The output is always directed to standard output.
- Accurate filter chain resolution relies on a properly installed and configured CUPS environment (e.g., correct cupsd.conf, PPD files, and MIME type definitions).
- MIME type detection can sometimes be ambiguous; explicitly specifying the input MIME type with -i is recommended for consistent results.
STANDARD OUTPUT USAGE
The filtered data is always sent to standard output (stdout). This design choice allows users to easily pipe the output to other commands, save it to a file for later use, or inspect it directly in the terminal. This makes cupsfilter highly versatile for integration into scripts or for detailed debugging purposes.
MIME TYPE RESOLUTION LOGIC
cupsfilter leverages the sophisticated MIME type rules defined within the CUPS system to determine the appropriate filter chain. If the input file's type cannot be confidently determined or is ambiguous, explicitly specifying it with the -i option ensures the correct filtering process is applied, preventing unexpected results.
HISTORY
cupsfilter has been a core utility within the CUPS project since its early versions. Its stable functionality, providing a direct interface to the CUPS filtering pipeline, underscores its significance for testing, debugging, and pre-processing print jobs. It has evolved alongside the CUPS daemon, adapting to new features and standards while maintaining its primary role as a powerful diagnostic and conversion tool for administrators and developers.