LinuxCommandLibrary

paperconf

Configure printer paper size

SYNOPSIS

paperconf [options]
Example: paperconf --paper

PARAMETERS

-p, --paper, --papersize
    Prints only the name of the default paper size (e.g., "A4", "letter").

-W, --width
    Prints only the width of the default paper size in points.

-H, --height
    Prints only the height of the default paper size in points.

-s, --size
    Prints the paper name, width, and height. This is often the default behavior if no specific output options are provided.

--no-pretty-print
    Suppresses the descriptive labels (e.g., "papername:", "width:") from the output, providing raw values suitable for scripting.

-h, --help
    Displays a help message and exits.

-V, --version
    Outputs version information and exits.

DESCRIPTION

paperconf is a utility designed to query and display the default paper size configured for the current system environment. It plays a crucial role for applications that need to adapt to locale-specific or administratively defined paper dimensions for printing or document layout.

The command prioritizes configuration sources in the following order: the PAPERCONF environment variable, followed by the /etc/papersize file. If neither of these specifies a paper size, paperconf intelligently determines the default by inspecting the system's locale settings (specifically LC_ALL, LC_PAPER, or LANG), usually defaulting to "letter" for US locales and "A4" for most other regions. Beyond just the paper name, it can also output the precise width and height of the paper in points, making it valuable for precise formatting tasks.

CAVEATS

The accuracy of paperconf's output heavily relies on correct system locale configuration or the presence of the /etc/papersize file. If these are misconfigured or absent, paperconf might default to a paper size that doesn't align with the user's actual locale or administrative settings. For instance, in some environments, it might default to A4 even if letter is preferred, or vice-versa, if locale information is ambiguous or not properly set up. It's primarily a query tool; to change the system-wide paper size, paperconfig must be used.

ENVIRONMENT VARIABLES

paperconf respects the PAPERCONF environment variable. If set, its value will be used as the paper size, overriding /etc/papersize and locale settings. Additionally, locale-related environment variables like LC_ALL, LC_PAPER, and LANG influence its fallback paper size determination.

CONFIGURATION FILE

The /etc/papersize file is a crucial configuration source. It should contain a single line specifying the default paper size (e.g., "A4" or "letter"). This file is typically managed by the paperconfig command.

HISTORY

paperconf is typically part of the util-linux or cups-filters package on many Linux distributions. Its history is tied to the evolution of printing systems and locale management in Unix-like environments. It was developed to provide a standardized way for applications, especially those involved in document formatting and printing, to retrieve the system's preferred paper dimensions, reducing hardcoded assumptions and improving internationalization. While not a standalone project with a distinct long history, its functionality has been essential for consistent paper size handling across various Linux desktop and server environments for many years.

SEE ALSO

Copied to clipboard