
D:\Devel\from-git\dia>d:\Devel\Git\bin\git diff plug-ins/cairo/diacairo-print.c 
diff --git a/plug-ins/cairo/diacairo-print.c b/plug-ins/cairo/diacairo-print.c
index ecaac72..6973e02 100644
--- a/plug-ins/cairo/diacairo-print.c
+++ b/plug-ins/cairo/diacairo-print.c
@@ -44,15 +44,30 @@ _dia_to_gtk_page_setup (const DiagramData *data, GtkPageSetup *setup)
   const double points_per_cm = 28.346457;
   const PaperInfo *paper = &(data->paper);
   int index = find_paper (paper->name);
+  double width, height;
+  gboolean swap = TRUE;
+
   if (index < 0)
     index = get_default_paper ();
-  paper_size = gtk_paper_size_new_from_ppd (
-		 paper->name, paper->name, 
-                 get_paper_pswidth (index) * points_per_cm, 
-		 get_paper_psheight (index) * points_per_cm);
 
-  gtk_page_setup_set_orientation (setup, data->paper.is_portrait ?
-    GTK_PAGE_ORIENTATION_PORTRAIT : GTK_PAGE_ORIENTATION_LANDSCAPE);
+  width = get_paper_pswidth (index) * points_per_cm;
+  height = get_paper_psheight (index) * points_per_cm;
+  /* By setting the print orientation to landscape we are also activating
+   * some content rotation, but only for PDF and Unix print - not for win32
+   * print. For PDF this gives rotated content at first view: bug #598399.
+   * For Unix print it might still be necessary
+   */
+  swap = (swap && !data->paper.is_portrait);
+  /* gtk_paper_size_new_from_ppd ignores the size if it know the name */
+  paper_size = gtk_paper_size_new_from_ppd (
+                 swap ? "Dia.Landscape" : paper->name, 
+		 paper->name,
+                 swap ? height : width,
+		 swap ? width : height);
+
+  if (!swap)
+    gtk_page_setup_set_orientation (setup, data->paper.is_portrait ?
+      GTK_PAGE_ORIENTATION_PORTRAIT : GTK_PAGE_ORIENTATION_LANDSCAPE);
   gtk_page_setup_set_paper_size (setup, paper_size);
 
   gtk_page_setup_set_left_margin (setup, data->paper.lmargin * 10, GTK_UNIT_MM);
