Gtk.PrintContext
Gtk.PrintContext — Encapsulates context for drawing pages
Object Hierarchy:
GObject
╰── Gtk.PrintContext
Functions:
- get_cairo_context
(self) -> cairo.Context - set_cairo_context
(self, cr:cairo.Context, dpi_x:float, dpi_y:float) - get_page_setup
(self) -> Gtk.PageSetup - get_width
(self) -> float - get_height
(self) -> float - get_dpi_x
(self) -> float - get_dpi_y
(self) -> float - get_pango_fontmap
(self) -> Pango.FontMap - create_pango_context
(self) -> Pango.Context - create_pango_layout
(self) -> Pango.Layout - get_hard_margins
(self) -> bool, top:float, bottom:float, left:float, right:float
Description:
A Gtk.PrintContext encapsulates context information that is required when drawing pages for printing, such as the cairo context and important parameters like page size and resolution. It also lets you easily create Pango.Layout and Pango.Context objects that match the font metrics of the cairo surface.
Gtk.PrintContext objects gets passed to the Gtk.PrintOperation::begin-print.
Printing support was added in GTK+ 2.10.
Function Details:
get_cairo_context()
get_cairo_context (self) -> cairo.Context
Obtains the cairo context that is associated with theGtk.PrintContext.
Returns: the cairo context of
context.Since: 2.10
set_cairo_context()
set_cairo_context (self, cr:cairo.Context, dpi_x:float, dpi_y:float)
Sets a new cairo context on a print context. This function is intended to be used when implementingan internal print preview, it is not needed for printing,since GTK+ itself creates a suitable cairo context in thatcase.
- Since: 2.10
get_page_setup()
get_page_setup (self) -> Gtk.PageSetup
Obtains the Gtk.PageSetup that determines the pagedimensions of the Gtk.PrintContext.
Returns: the page setup of
context.Since: 2.10
get_width()
get_width (self) -> float
Obtains the width of the Gtk.PrintContext, in pixels.
Returns: the width of
contextSince: 2.10
get_height()
get_height (self) -> float
Obtains the height of the Gtk.PrintContext, in pixels.
Returns: the height of
contextSince: 2.10
get_dpi_x()
get_dpi_x (self) -> float
Obtains the horizontal resolution of the Gtk.PrintContext,in dots per inch.
Returns: the horizontal resolution of
contextSince: 2.10
get_dpi_y()
get_dpi_y (self) -> float
Obtains the vertical resolution of the Gtk.PrintContext,in dots per inch.
Returns: the vertical resolution of
contextSince: 2.10
get_pango_fontmap()
get_pango_fontmap (self) -> Pango.FontMap
Returns a PangoFontMap that is suitable for usewith the Gtk.PrintContext.
Returns: the font map of
context.Since: 2.10
create_pango_context()
create_pango_context (self) -> Pango.Context
Creates a new PangoContext that can be used with theGtk.PrintContext.
Returns: a new Pango context for
context.Since: 2.10
create_pango_layout()
create_pango_layout (self) -> Pango.Layout
Creates a new PangoLayout that is suitable for usewith the Gtk.PrintContext.
Returns: a new Pango layout for
context.Since: 2.10
get_hard_margins()
get_hard_margins (self) -> bool, top:float, bottom:float, left:float, right:float
Obtains the hardware printer margins of the Gtk.PrintContext, in units.
Returns:
Trueif the hard margins were retrievedSince: 2.20