Gtk.PaperSize


Gtk.PaperSize — Support for named paper sizes

Object Hierarchy:

    GBoxed
    ╰── Gtk.PaperSize

See also:

Gtk.PageSetup


Functions:

Description:

Gtk.PaperSize handles paper sizes. It uses the standard called PWG 5101.1-2002 PWG: Standard for Media Standardized Names to name the paper sizes (and to get the data for the page sizes).

In addition to standard paper sizes, Gtk.PaperSize allows to construct custom paper sizes with arbitrary dimensions.

The Gtk.PaperSize object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.

Printing support has been added in GTK+ 2.10.


Function Details:

new()

new (name:str=None) -> Gtk.PaperSize

Creates a new Gtk.PaperSize object by parsing aPWG 5101.1-2002paper name. If name is None, the default paper size is returned,see Gtk.PaperSize:get_default().

  • Returns: a new Gtk.PaperSize, use Gtk.PaperSize:free()to free it

  • Since: 2.10


new_from_ppd()

new_from_ppd (ppd_name:str, ppd_display_name:str, width:float, height:float) -> Gtk.PaperSize

Creates a new Gtk.PaperSize object by usingPPD information. If ppd_name is not a recognized PPD paper name,ppd_display_name, width and height are used toconstruct a custom Gtk.PaperSize object.

  • Returns: a new Gtk.PaperSize, use Gtk.PaperSize:free()to free it

  • Since: 2.10


new_from_ipp()

new_from_ipp (ipp_name:str, width:float, height:float) -> Gtk.PaperSize

Creates a new Gtk.PaperSize object by usingIPP information. If ipp_name is not a recognized paper name,width and height are used toconstruct a custom Gtk.PaperSize object.

  • Returns: a new Gtk.PaperSize, use Gtk.PaperSize:free()to free it

  • Since: 3.16


new_custom()

new_custom (name:str, display_name:str, width:float, height:float, unit:Gtk.Unit) -> Gtk.PaperSize

Creates a new Gtk.PaperSize object with thegiven parameters.

  • Returns: a new Gtk.PaperSize object, use Gtk.PaperSize:free()to free it

  • Since: 2.10


copy()

copy (self) -> Gtk.PaperSize

Copies an existing Gtk.PaperSize.

  • Returns: a copy of other

  • Since: 2.10


free()

free (self)

Free the given Gtk.PaperSize object.

  • Since: 2.10

is_equal()

is_equal (self, size2:Gtk.PaperSize) -> bool

Compares two Gtk.PaperSize objects.

  • Returns: True, if size1and size2represent the same paper size

  • Since: 2.10


get_paper_sizes()

get_paper_sizes (include_custom:bool) -> list

Creates a list of known paper sizes.

  • Returns: a newly allocated list of newlyallocated Gtk.PaperSize objects.

  • Since: 2.12


get_name()

get_name (self) -> str

Gets the name of the Gtk.PaperSize.

  • Returns: the name of size

  • Since: 2.10


get_display_name()

get_display_name (self) -> str

Gets the human-readable name of the Gtk.PaperSize.

  • Returns: the human-readable name of size

  • Since: 2.10


get_ppd_name()

get_ppd_name (self) -> str

Gets the PPD name of the Gtk.PaperSize, whichmay be None.

  • Returns: the PPD name of size

  • Since: 2.10


get_width()

get_width (self, unit:Gtk.Unit) -> float

Gets the paper width of the Gtk.PaperSize, inunits of unit.

  • Returns: the paper width

  • Since: 2.10


get_height()

get_height (self, unit:Gtk.Unit) -> float

Gets the paper height of the Gtk.PaperSize, inunits of unit.

  • Returns: the paper height

  • Since: 2.10


is_ipp()

is_ipp (self) -> bool

Returns True if size is an IPP standard paper size.

  • Returns: whether sizeis not an IPP custom paper size.

is_custom()

is_custom (self) -> bool

Returns True if size is not a standard paper size.

  • Returns: whether sizeis a custom paper size.

set_size()

set_size (self, width:float, height:float, unit:Gtk.Unit)

Changes the dimensions of a size to width x height.

  • Since: 2.10

get_default_top_margin()

get_default_top_margin (self, unit:Gtk.Unit) -> float

Gets the default top margin for the Gtk.PaperSize.

  • Returns: the default top margin

  • Since: 2.10


get_default_bottom_margin()

get_default_bottom_margin (self, unit:Gtk.Unit) -> float

Gets the default bottom margin for the Gtk.PaperSize.

  • Returns: the default bottom margin

  • Since: 2.10


get_default_left_margin()

get_default_left_margin (self, unit:Gtk.Unit) -> float

Gets the default left margin for the Gtk.PaperSize.

  • Returns: the default left margin

  • Since: 2.10


get_default_right_margin()

get_default_right_margin (self, unit:Gtk.Unit) -> float

Gets the default right margin for the Gtk.PaperSize.

  • Returns: the default right margin

  • Since: 2.10


get_default()

get_default () -> str

Returns the name of the default paper size, whichdepends on the current locale.

  • Returns: the name of the default paper size. The stringis owned by GTK+ and should not be modified.

  • Since: 2.10


new_from_key_file()

new_from_key_file (key_file:GLib.KeyFile, group_name:str) -> Gtk.PaperSize

Reads a paper size from the group group_name in the key filekey_file.

  • Returns: a new Gtk.PaperSize object with the restoredpaper size, or None if an error occurred

  • Since: 2.12


to_key_file()

to_key_file (self, key_file:GLib.KeyFile, group_name:str)

This function adds the paper size from size to key_file.

  • Since: 2.12

results matching ""

    No results matching ""