summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation-unix.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2006-05-05 11:03:33 +0000
committerAlexander Larsson <alexl@src.gnome.org>2006-05-05 11:03:33 +0000
commit719050ed1f76ff1989e8cb6ea18dd7b738561b42 (patch)
tree8d97de6498efada5b9325275882cbce137a6f773 /gtk/gtkprintoperation-unix.c
parentf78961034b065b5037863abafacfc003eb9b7093 (diff)
downloadgtk+-719050ed1f76ff1989e8cb6ea18dd7b738561b42.tar.gz
Implement per-page paper sizes.
2006-05-05 Alexander Larsson <alexl@redhat.com> * gtk/gtkprintoperation-unix.c: Implement per-page paper sizes. * gtk/gtkprintoperation.c: Implement per-page paper sizes for pdf output. Make gtk_print_operation_set_pdf_target() work again * tests/Makefile.am: * tests/testprint.c: * tests/testprintfileoperation.[ch]: Add more test code for printing support. This tests per-page paper sizes & orientation and deriving from GtkPrintOperation.
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r--gtk/gtkprintoperation-unix.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index 3b6f5561f5..a411445462 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -58,7 +58,21 @@ unix_start_page (GtkPrintOperation *op,
GtkPrintContext *print_context,
GtkPageSetup *page_setup)
{
+ GtkPaperSize *paper_size;
+ cairo_surface_type_t type;
+ double w, h;
+ paper_size = gtk_page_setup_get_paper_size (page_setup);
+
+ w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
+ h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+
+ type = cairo_surface_get_type (op->priv->surface);
+
+ if (type == CAIRO_SURFACE_TYPE_PS)
+ cairo_ps_surface_set_size (op->priv->surface, w, h);
+ else if (type == CAIRO_SURFACE_TYPE_PDF)
+ cairo_pdf_surface_set_size (op->priv->surface, w, h);
}
static void