PyFriends,

Im having problems on priting trough gtk.PrintOperation. It doesn't
print on the way it should.

Instead of printing "PRINT OUT THIS!!!!!!", its printing something like this:
"""
RINT
OUT
HIS!!!!!!
"""

Here is the code:

<code>

SETTINGS = None

def draw_page(operation, context, page_nr):
    cairo_context = context.get_cairo_context()
    width = context.get_width()

    cairo_context.fill()
    layout = context.create_pango_layout()

    description = pango.FontDescription("Sans 12")
    layout.set_font_description(description)

    layout.set_text("\n\n\nPRINT OUT THIS!!!!!!")   # Here is what it
should print out
    layout.set_width(int(width))
    layout.set_alignment(pango.ALIGN_CENTER)

    cairo_context.show_layout(layout)

def do_print():
    print_op = gtk.PrintOperation()
    global SETTINGS
    if SETTINGS != None:
        print_op.set_print_settings(settings)

    print_op.connect("draw_page", draw_page)

    print_op.set_n_pages(1)
    res = print_op.run(gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG)

    if res == gtk.PRINT_OPERATION_RESULT_APPLY:
        SETTINGS = print_op.get_print_settings()

do_print()

</code>

Someone could help?

Sorry my poor english,

Thanks,

EduardoWillians
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to