diff --git a/src/docgen/GtkPrint.py b/src/docgen/GtkPrint.py index 6c537628f..1d0ce3f25 100644 --- a/src/docgen/GtkPrint.py +++ b/src/docgen/GtkPrint.py @@ -595,8 +595,14 @@ class GtkPrint(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)