Next: , Previous: GtkPageSetup, Up: Top


113 GtkPaperSize

Support for named paper sizes

113.1 Overview

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 <gtk-paper-size> 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.

113.2 Usage

— Class: <gtk-paper-size>

Derives from <gboxed>.

This class defines no direct slots.

— Function: gtk-paper-size-new (name mchars) ⇒  (ret <gtk-paper-size>)

Creates a new <gtk-paper-size> object by parsing a PWG 5101.1-2002 PWG paper name.

If name is ‘#f’, the default paper size is returned, see gtk-paper-size-get-default.

name
a paper size name, or ‘#f
ret
a new <gtk-paper-size>, use gtk-paper-size-free to free it

Since 2.10

— Function: gtk-paper-size-new-from-ppd (ppd_name mchars) (ppd_display_name mchars) (width double) (height double) ⇒  (ret <gtk-paper-size>)

Creates a new <gtk-paper-size> 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 <gtk-paper-size> object.

ppd-name
a PPD paper name
ppd-display-name
the corresponding human-readable name
width
the paper width, in points
height
the paper height in points
ret
a new <gtk-paper-size>, use gtk-paper-size-free to free it

Since 2.10

— Function: gtk-paper-size-new-custom (name mchars) (display_name mchars) (width double) (height double) (unit <gtk-unit>) ⇒  (ret <gtk-paper-size>)

Creates a new <gtk-paper-size> object with the given parameters.

name
the paper name
display-name
the human-readable name
width
the paper width, in units of unit
height
the paper height, in units of unit
unit
the unit for width and height
ret
a new <gtk-paper-size> object, use gtk-paper-size-free to free it

Since 2.10

— Function: gtk-paper-size-is-equal (self <gtk-paper-size>) (size2 <gtk-paper-size>) ⇒  (ret bool)

Compares two <gtk-paper-size> objects.

size1
a <gtk-paper-size> object
size2
another <gtk-paper-size> object
ret
#t’, if size1 and size2 represent the same paper size

Since 2.10

— Function: gtk-paper-size-get-name (self <gtk-paper-size>) ⇒  (ret mchars)

Gets the name of the <gtk-paper-size>.

size
a <gtk-paper-size> object
ret
the name of size

Since 2.10

— Function: gtk-paper-size-get-display-name (self <gtk-paper-size>) ⇒  (ret mchars)

Gets the human-readable name of the <gtk-paper-size>.

size
a <gtk-paper-size> object
ret
the human-readable name of size

Since 2.10

— Function: gtk-paper-size-get-ppd-name (self <gtk-paper-size>) ⇒  (ret mchars)

Gets the PPD name of the <gtk-paper-size>, which may be ‘#f’.

size
a <gtk-paper-size> object
ret
the PPD name of size

Since 2.10

— Function: gtk-paper-size-get-width (self <gtk-paper-size>) (unit <gtk-unit>) ⇒  (ret double)

Gets the paper width of the <gtk-paper-size>, in units of unit.

size
a <gtk-paper-size> object
unit
the unit for the return value
ret
the paper width

Since 2.10

— Function: gtk-paper-size-get-height (self <gtk-paper-size>) (unit <gtk-unit>) ⇒  (ret double)

Gets the paper height of the <gtk-paper-size>, in units of unit.

size
a <gtk-paper-size> object
unit
the unit for the return value
ret
the paper height

Since 2.10

— Function: gtk-paper-size-is-custom (self <gtk-paper-size>) ⇒  (ret bool)

Returns ‘#t’ if size is not a standard paper size.

size
a <gtk-paper-size> object
ret
whether size is a custom paper size.
— Function: gtk-paper-size-set-size (self <gtk-paper-size>) (width double) (height double) (unit <gtk-unit>)

Changes the dimensions of a size to width x height.

size
a custom <gtk-paper-size> object
width
the new width in units of unit
height
the new height in units of unit
unit
the unit for width and height

Since 2.10

— Function: gtk-paper-size-get-default ⇒  (ret mchars)

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

ret
the name of the default paper size. The string is owned by GTK+ and should not be modified.

Since 2.10