gtk.PrintContext — Encapsulates context for drawing pages (new in PyGTK 2.10)
| class gtk.PrintContext( | 
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 "begin-print", "end-print",
    "request-page-setup" and "draw-page" signals on the gtk.PrintOperation.
Example 2. Using gtk.PrintContext
in a "draw-page" callback
def draw_page(operation, context, page_nr):
  cr = context.get_cairo_context()
  # Draw a red rectangle, as wide as the paper (inside the margins)
  cr.set_source_rgb(1.0, 0, 0)
  cr.rectangle(0, 0, context.get_width(), 50)
  
  cr.fill()
  # Draw some lines
  cr.move_to(20, 10)
  cr.line_to(40, 20)
  cr.arc(60, 60, 20, 0, M_PI)
  cr.line_to(80, 20)
  
  cr.set_source_rgb(0, 0, 0)
  cr.set_line_width(5)
  cr.set_line_cap(cairo.LINE_CAP_ROUND)
  cr.set_line_join(cairo.LINE_JOIN_ROUND)
  
  cr.stroke()
  # Draw some text
  layout = cr.create_layout()
  layout.set_text("Hello World! Printing is easy")
  desc = pango.FontDescription("sans 28")
  layout.set_font_description(desc)
  cr.move_to(30, 20)
  cr.layout_path(layout)
  # Font Outline
  cr.set_source_rgb(0.93, 1.0, 0.47)
  cr.set_line_width(0.5)
  cr.stroke_preserve()
  # Font Fill
  cr.set_source_rgb(0, 0.0, 1.0)
  cr.fill()
Printing support was added in GTK+ 2.10.
    def get_cairo_context()| Returns : | the cairo context | 
This method is available in PyGTK 2.10 and above.
The get_cairo_context() method returns
      the cairo context that is associated with the gtk.PrintContext.
    def get_page_setup()| Returns : | the page setup | 
This method is available in PyGTK 2.10 and above.
The get_page_setup() method returns the
      gtk.PageSetup
      that determines the page dimensions of the gtk.PrintContext.
    def get_width()| Returns : | the width | 
This method is available in PyGTK 2.10 and above.
The get_width() method returns the width
      of the gtk.PrintContext,
      in pixels.
    def get_height()| Returns : | the height | 
This method is available in PyGTK 2.10 and above.
The get_height() method returns the
      width of the gtk.PrintContext,
      in pixels.
    def get_dpi_x()| Returns : | the horizontal resolution | 
This method is available in PyGTK 2.10 and above.
The get_dpi_x() method returns the
      horizontal resolution of the gtk.PrintContext,
      in dots per inch.
    def get_dpi_y()| Returns : | the vertical resolution | 
This method is available in PyGTK 2.10 and above.
The get_dpi_y() method returns the
      vertical resolution of the gtk.PrintContext,
      in dots per inch.
    def get_pango_fontmap()| Returns : | the font map | 
This method is available in PyGTK 2.10 and above.
The method returns a pango.FontMap
      that is suitable for use with the gtk.PrintContext.
    def create_pango_context()| Returns : | a new pango.Context | 
This method is available in PyGTK 2.10 and above.
The create_pango_context() method
      creates a new pango.Context
      that can be used with the gtk.PrintContext.
    def create_pango_layout()| Returns : | a new pango.Layout | 
This method is available in PyGTK 2.10 and above.
The create_pango_layout() method
      creates a new pango.Layout
      that is suitable for use with the gtk.PrintContext.
    def set_cairo_context(cr, dpi_x, dpi_y)| 
 | |
| 
 | |
| 
 | 
This method is available in PyGTK 2.10 and above.
The set_cairo_context() method sets the
      CairoContext specified by cr as the cairo
      context for the print context. dpi_x and
      dpi_y specify the horizontal and vertical
      resolution of the print context.