From 4d71c10ed216be5f0f4dc52e28696a204988dd3d Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 21 Nov 2017 00:54:29 +0100 Subject: Fix printing multiple copies of a document Previously only the first page was printed properly, all following pages were either blank or were not printed at all. This was caused by finishing/destroying the cairo surface of the cairo context associated with the GtkPrintContext used for printing which made it impossible to draw to it for any consecutive page Fixed bugs: - https://bugs.launchpad.net/inkscape/+bug/1733424 - https://bugs.launchpad.net/inkscape/+bug/490866 --- src/ui/dialog/print.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 532a8c364..ea99ffa19 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -35,6 +35,10 @@ static void draw_page(GtkPrintOperation *, gint /*page_nr*/, gpointer user_data) { + // TODO: If the user prints multiple copies we render the whole page for each copy + // It would be more efficient to render the page once (e.g. in "begin_print") + // and simply print this result as often as necessary + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data; //printf("%s %d\n",__FUNCTION__, page_nr); @@ -120,7 +124,7 @@ static void draw_page(GtkPrintOperation *, ret = renderer.setupDocument (ctx, junk->_doc, TRUE, 0., NULL); if (ret) { renderer.renderItem(ctx, junk->_base); - ctx->finish(); + ctx->finish(false); // do not finish the cairo_surface_t - it's owned by our GtkPrintContext! } else { g_warning("%s", _("Could not set up Document")); -- cgit v1.2.3