SDB:No Landscape Format with CUPS

Şuraya atla: kullan, ara

Version: 8.1


When printing with CUPS from certain programs (e.g., a2ps) or applications (e.g. Netscape), the output is always printed in portrait instead of landscape format. Thus, some parts of the printer output are cut off.

In such cases, it is not even possible to force landscape format or portrait format by using certain CUPS parameters, for example:
lp -o landscape PostScript-file
lp -o portrait PostScript-file


Programs, applications, and CUPS use different interpretations of the landscape or portrait format when specified in the PostScript code in the form: %%Orientation: Landscape
%%Orientation: Portrait.

For example, when the PostScript code says %%Orientation: Landscape, the CUPS printing system rotates the printer output ninety degrees to make it suitable for a printout on paper. This is fed to the printer in landscape orientation (long edge first). However, if the printer output in the PostScript file has already been rotated by the program or application to adapt it to the landscape mode so the printer output can be printed in portrait format (short edge first), the second rotation performed by the CUPS printing system results in the wrong orientation.


Replace %%Orientation: Landscape with %%Orientation: Portrait in the PostScript code if the output in the PostScript file has already been correctly rotated by the program or application so the printer output can be printed on paper with portrait orientation (short edge first).

This can be done with the following sed command:

sed -e 's/Orientation: Landscape/Orientation: Portrait/' PostScript-file >

The altered PostScript file can now be printed with the right orientation.

To print directly from applications (e.g., Netscape), enter the corresponding printing command in the application

sed -e 's/Orientation: Landscape/Orientation: Portrait/' | lpr


sed -e 's/Orientation: Landscape/Orientation: Portrait/' | kprinter --stdin

This does not obstruct printing in portrait mode, because %%Orientation: Portrait remains unchanged.

For a2ps

If you do not use a2ps directly or do not know how to configure a2ps, do not change anything here. Otherwise, you can insert the sed command for a2ps in /etc/a2ps-site.cfg by replacing the line

UnknownPrinter: | #{lp} #o

with something like

UnknownPrinter: | sed -e 's/Orientation: Landscape/Orientation: Portrait/' | #{lp} #o

The "DefaultPrinter" line must also be edited accordingly.

We would like to thank Mr. Willy Weisz for this information about the a2ps configuration.

The sed command can be built-in in other programs in a similar way to correct the printing output automatically. Refer to the program documentation. In any case, you can always print to a file then use the sed command on that file (provided the file's printing output is PostScript).

For CUPS Experts Only

The sed command is a workaround to correct the application's printing output and it must be specifically configured on each case depending on the application.

CUPS version 1.1.18 is an alternative solution that circumvents this problem, enabling normal printing in landscape format. The feedback on CUPS 1.1.18 has been exclusively positive so far. It already contains the security fixes that would require an update from ""

No warranty, guarantee, or support is provided for CUPS 1.1.18, because CUPS 1.1.18 includes a new version of the CUPS libraries (package cups-libs), which are required by several important programs (e.g., Ghostscript, KDE, Samba, Wine, and YaST2's printer configuration). These programs are linked to the CUPS libraries and a different version might cause some difficulties.

Problems with CUPS 1.1.18 might arise especially in connection with USB printers, because CUPS 1.1.18 uses a different type of device URI for USB printers (usb://VENDOR/MODEL?serial=...). In CUPS 1.1.18, the device URI only depends on the printer model and is no longer attached to a fixed device file (/dev/usb/lp...). For CUPS 1.1.18 and connected USB printers, see the output of /usr/lib/cups/backend/usb. It might also be necessary to adjust the device URI in /etc/cups/printers.conf. Entering the device file (usb:/dev/usb/lp...) directly should still work.

SDB:Print Settings with CUPS

SDB:Print Settings for ASCII Texts with CUPS