Gjsify LogoGjsify Logo

GtkPaperSize 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, GtkPaperSize allows to construct custom paper sizes with arbitrary dimensions.

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

record

Hierarchy

  • PaperSize

Index

Constructors

  • Creates a new GtkPaperSize object by parsing a PWG 5101.1-2002 paper name.

    If name is %NULL, the default paper size is returned, see [funcGtk.PaperSize.get_default].

    Parameters

    • name: string

      a paper size name

    Returns Gtk.PaperSize

Properties

name: string

Methods

  • free(): void
  • getDefaultBottomMargin(unit: Gtk.Unit): number
  • Gets the default bottom margin for the GtkPaperSize.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • getDefaultLeftMargin(unit: Gtk.Unit): number
  • Gets the default left margin for the GtkPaperSize.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • getDefaultRightMargin(unit: Gtk.Unit): number
  • Gets the default right margin for the GtkPaperSize.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • getDefaultTopMargin(unit: Gtk.Unit): number
  • Gets the default top margin for the GtkPaperSize.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • getDisplayName(): string
  • Gets the human-readable name of the GtkPaperSize.

    Returns string

  • Gets the paper height of the GtkPaperSize, in units of unit.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • getName(): string
  • getPpdName(): string
  • Gets the PPD name of the GtkPaperSize, which may be %NULL.

    Returns string

  • Gets the paper width of the GtkPaperSize, in units of unit.

    Parameters

    • unit: Gtk.Unit

      the unit for the return value, not %GTK_UNIT_NONE

    Returns number

  • isCustom(): boolean
  • Returns %TRUE if size is not a standard paper size.

    Returns boolean

  • isIpp(): boolean
  • Returns %TRUE if size is an IPP standard paper size.

    Returns boolean

  • setSize(width: number, height: number, unit: Gtk.Unit): void
  • Changes the dimensions of a size to width x height.

    Parameters

    • width: number

      the new width in units of unit

    • height: number

      the new height in units of unit

    • unit: Gtk.Unit

      the unit for width and height

    Returns void

  • toKeyFile(keyFile: GLib.KeyFile, groupName: string): void
  • This function adds the paper size from size to key_file.

    Parameters

    • keyFile: GLib.KeyFile

      the GKeyFile to save the paper size to

    • groupName: string

      the group to add the settings to in key_file

    Returns void

  • getDefault(): string
  • Returns the name of the default paper size, which depends on the current locale.

    Returns string

  • Creates a list of known paper sizes.

    Parameters

    • includeCustom: boolean

      whether to include custom paper sizes as defined in the page setup dialog

    Returns Gtk.PaperSize[]

  • Creates a new GtkPaperSize object by parsing a PWG 5101.1-2002 paper name.

    If name is %NULL, the default paper size is returned, see [funcGtk.PaperSize.get_default].

    Parameters

    • name: string

      a paper size name

    Returns Gtk.PaperSize

  • newCustom(name: string, displayName: string, width: number, height: number, unit: Gtk.Unit): Gtk.PaperSize
  • Creates a new GtkPaperSize object with the given parameters.

    Parameters

    • name: string

      the paper name

    • displayName: string

      the human-readable name

    • width: number

      the paper width, in units of unit

    • height: number

      the paper height, in units of unit

    • unit: Gtk.Unit

      the unit for width and height. not %GTK_UNIT_NONE.

    Returns Gtk.PaperSize

  • Deserialize a paper size from a GVariant.

    The GVariant must be in the format produced by [methodGtk`.PaperSize.to_gvariant].

    Parameters

    Returns Gtk.PaperSize

  • newFromIpp(ippName: string, width: number, height: number): Gtk.PaperSize
  • Creates a new GtkPaperSize object by using IPP information.

    If ipp_name is not a recognized paper name, width and height are used to construct a custom GtkPaperSize object.

    Parameters

    • ippName: string

      an IPP paper name

    • width: number

      the paper width, in points

    • height: number

      the paper height in points

    Returns Gtk.PaperSize

  • Reads a paper size from the group group_name in the key file key_file.

    Parameters

    • keyFile: GLib.KeyFile

      the GKeyFile to retrieve the papersize from

    • groupName: string

      the name of the group in the key file to read, or %NULL to read the first group

    Returns Gtk.PaperSize

  • newFromPpd(ppdName: string, ppdDisplayName: string, width: number, height: number): Gtk.PaperSize
  • Creates a new GtkPaperSize object by using PPD information.

    If ppd_name is not a recognized PPD paper name, ppd_display_name, width and height are used to construct a custom GtkPaperSize object.

    Parameters

    • ppdName: string

      a PPD paper name

    • ppdDisplayName: string

      the corresponding human-readable name

    • width: number

      the paper width, in points

    • height: number

      the paper height in points

    Returns Gtk.PaperSize

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method