Друк
Most applications need to provide support for printing. Users expect to be able to print the contents they can view on-screen. The GNOME platform provides libraries to help you add support for high-quality printing to your application.
- 3.7.1. Друк GNOME
- 3.7.2. CUPS
3.7.1. Друк GNOME
Note that this section is outdated and that libgnomeprint and libgnomeprintui have been deprecated in favor of GtkPrint. Printing has been integrated directly into GTK+ 2.10 and later versions, providing a cross-platform print API that all applications can use. API and ABI stability guarantees ensures that Gnomeprint will continue to be functional and supported throughout the GNOME 2 lifecycle.
The GNOME print framework consists of two libraries which help you provide high-quality printing with a consistent interface in your application. At the core of the printing framework is libgnomeprint, a library for creating PostScript output to send to printers. On top of that is libgnomeprintui, which provides standard print controls for your user interface.
The libgnomeprint library implements the PostScript imaging model, which is used by most printers. Printers which do not support PostScript can still be supported through CUPS, described below. In addition to the standard PostScript imaging, libgnomeprint also features alpha channel support and anti-aliasing.
The libgnomeprintui library provides a standard print dialog, a print preview dialog, and various other controls and functionality required to build printing into an intuitive user interface. The GNOME print framework handles the details of locating printers and spooling print jobs, and also provides PostScript and PDF export directly in the print dialog.
You should use libgnomeprint whenever you need to render content to PostScript for printing. You should use libgnomeprintui to construct your printing user interface, even if your rendered output comes from another source. Using the GNOME print framework provides your users a consistent user interface with the features they expect of printing appliations.
3.7.2. CUPS
On most GNOME systems, CUPS (Common UNIX Printing System) acts as the low-level printing system. CUPS provides a modern, feature-rich architecture for printer discovery, printer option access, and spooling print jobs to different types of printers.
CUPS provides a set of utilities for automatically discovering printers locally and on the network. This allows users not only to see all available printers, but to use different types of printers without manual configuration.
CUPS provides a unified interface for printing, regardless of the location or type of the printer. Multiple print protocols are handled seamlessly by CUPS by automatically applying filters to content sent to the printers. Applications can simply provide PostScript output, and CUPS will automatically convert it for printers that do not support PostScript natively.
CUPS also provides printer configuration options in the form of PostScript Printer Description (PPD) files. PPD configurations allow applications to expose the capabilities of individual printers to the users with a consistent user interface. For instance, PPD allows you to detect whether a printer can collate and staple print jobs, and to provide an option in your user interface.
In most cases, you will not need to interface directly with CUPS in your applications. By using the GNOME print framework, you have access to the power and flexibility of CUPS automatically. Having CUPS underneath means a better user experience with less programming.