summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation-unix.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2009-09-30 12:46:58 -0400
committerMatthias Clasen <mclasen@redhat.com>2009-09-30 12:46:58 -0400
commit4261efda2bdcc458f9e0898f3d9c9861c124c6d0 (patch)
tree4b80e8eeb0ba8321dba04c571cab7408410fa71b /gtk/gtkprintoperation-unix.c
parentdd52987d1fe3c3481fffc5b776fcac6b02114b01 (diff)
downloadgtk+-4261efda2bdcc458f9e0898f3d9c9861c124c6d0.tar.gz
Emit PageOrientation DSC comment into PostScript print output
The PageOrientation DSC comment tells PostScript viewers such as gv or evince the orientation to use when displaying the page. Part of bug 596423
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r--gtk/gtkprintoperation-unix.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index 84d819dacc..64b3a38e07 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -91,9 +91,26 @@ unix_start_page (GtkPrintOperation *op,
(op->priv->page_position % op->priv->manual_number_up == 0))
{
if (type == CAIRO_SURFACE_TYPE_PS)
- cairo_ps_surface_set_size (op_unix->surface, w, h);
+ {
+ cairo_ps_surface_set_size (op_unix->surface, w, h);
+ cairo_ps_surface_dsc_begin_page_setup (op_unix->surface);
+ switch (gtk_page_setup_get_orientation (page_setup))
+ {
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ cairo_ps_surface_dsc_comment (op_unix->surface, "%%PageOrientation: Portrait");
+ break;
+
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_ps_surface_dsc_comment (op_unix->surface, "%%PageOrientation: Landscape");
+ break;
+ }
+ }
else if (type == CAIRO_SURFACE_TYPE_PDF)
- cairo_pdf_surface_set_size (op_unix->surface, w, h);
+ {
+ cairo_pdf_surface_set_size (op_unix->surface, w, h);
+ }
}
}