GtkPrintContext            package:RGtk2            R Documentation

_G_t_k_P_r_i_n_t_C_o_n_t_e_x_t

_D_e_s_c_r_i_p_t_i_o_n:

     Encapsulates context for drawing pages

_M_e_t_h_o_d_s _a_n_d _F_u_n_c_t_i_o_n_s:

     'gtkPrintContextGetCairoContext(object)'
      'gtkPrintContextSetCairoContext(object, cr, dpi.x, dpi.y)'
      'gtkPrintContextGetPageSetup(object)'
      'gtkPrintContextGetWidth(object)'
      'gtkPrintContextGetHeight(object)'
      'gtkPrintContextGetDpiX(object)'
      'gtkPrintContextGetDpiY(object)'
      'gtkPrintContextGetPangoFontmap(object)'
      'gtkPrintContextCreatePangoContext(object)'
      'gtkPrintContextCreatePangoLayout(object)'

_H_i_e_r_a_r_c_h_y:

     GObject
        +----GtkPrintContext 

_D_e_t_a_i_l_e_d _D_e_s_c_r_i_p_t_i_o_n:

     A GtkPrintContext 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 'PangoLayout' and 'PangoContext'
     objects that match the font metrics  of the cairo surface.

     GtkPrintContext objects gets passed to the ::begin-print,
     ::end-print,  ::request-page-setup and ::draw-page signals on the
     'GtkPrintOperation'.

     _Using GtkPrintContext in a ::draw-page callback_


     draw_page <- function(operation, context, page_nr)
     {
       cr <- context$getCairoContext()

       # Draw a red rectangle, as wide as the paper (inside the
     margins)
       cr$setSourceRgb(1.0, 0, 0)
       cr$rectangle(0, 0, context$getWidth(), 50)

       cr$fill()

       # Draw some lines
       cr$moveTo(20, 10)
       cr$lineTo(40, 20)
       cr$arc(60, 60, 20, 0, pi)
       cr$lineTo(80, 20)

       cr$setSourceRgb(0, 0, 0)
       cr$setLineWidth(5)
       cr$setLineCap("round")
       cr$setLineJoin("round")

       cr$stroke()

       # Draw some text

       layout <- context$createLayout()
       layout$setText("Hello World! Printing is easy")
       desc <- pangoFontDescriptionFromString("sans 28")
       layout$setFontDescription(desc)

       cr$moveTo(30, 20)
       cr$layoutPath(layout)

       # Font Outline
       cr$setSourceRgb(0.93, 1.0, 0.47)
       cr$setLineWidth(0.5)
       cr$strokePreserve()

       # Font Fill
       cr$setSourceRgb(0, 0.0, 1.0)
       cr$fill()
     }
      Printing support was added in GTK+ 2.10.

_S_t_r_u_c_t_u_r_e_s:


     '_G_t_k_P_r_i_n_t_C_o_n_t_e_x_t' _undocumented _


_A_u_t_h_o_r(_s):

     Derived by RGtkGen from GTK+ documentation

_R_e_f_e_r_e_n_c_e_s:

     <URL:
     http://developer.gnome.org/doc/API/2.0/gtk/GtkPrintContext.html>

