From ac6ef2a9bcb6068f9cf42bd0ccbc606d1dd224e3 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Tue, 19 May 2009 09:00:48 +0000 Subject: [PATCH] 2956: Errors with GTKPrint on Ubuntu 9.04 svn: r12547 --- src/plugins/docgen/GtkPrint.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/docgen/GtkPrint.py b/src/plugins/docgen/GtkPrint.py index 859125955..e9ddefb52 100644 --- a/src/plugins/docgen/GtkPrint.py +++ b/src/plugins/docgen/GtkPrint.py @@ -589,8 +589,14 @@ class GtkPrint(libcairodoc.CairoDoc): # give a dummy cairo context to gtk.PrintContext, # PrintPreview will update it with the real one - width = int(round(context.get_width())) - height = int(round(context.get_height())) + try: + width = int(round(context.get_width())) + except ValueError: + width = 0 + try: + height = int(round(context.get_height())) + except ValueError: + height = 0 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) cr = cairo.Context(surface) context.set_cairo_context(cr, PRINTER_DPI, PRINTER_DPI)