Index: gtk/gtkprintunixdialog.c
===================================================================
--- gtk/gtkprintunixdialog.c	(revision 22575)
+++ gtk/gtkprintunixdialog.c	(working copy)
@@ -2426,6 +2426,7 @@
   GtkNumberUpLayout          layout;
   GtkPrinterOption          *option;
   GtkPrinterOption          *old_option;
+  GtkPageOrientation         page_orientation;
 
   set = priv->options;
 
@@ -2443,10 +2444,22 @@
                                                                     GTK_PRINTER_OPTION_TYPE_PICKONE);
           gtk_printer_option_allocate_choices (priv->number_up_layout_2_option, 2);
 
-          priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
-          priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[2];
-          priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Left to right"));
-          priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Right to left"));
+          page_orientation = gtk_page_setup_get_orientation (gtk_print_unix_dialog_get_page_setup (dialog));
+          if (page_orientation == GTK_PAGE_ORIENTATION_PORTRAIT ||
+              page_orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
+            {
+              priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
+              priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[2];
+              priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Left to right"));
+              priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Right to left"));
+            }
+          else
+            {
+              priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
+              priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[1];
+              priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Top to bottom"));
+              priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Bottom to top"));
+            }
         }
 
       layout = dialog_get_number_up_layout (dialog);
@@ -2466,12 +2479,20 @@
               option = priv->number_up_layout_2_option;
 
               if (layout == GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM ||
-                  layout == GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP ||
-                  layout == GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT ||
+                  layout == GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT)
+                enum_value = g_enum_get_value (enum_class, GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM);
+
+              if (layout == GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP ||
                   layout == GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT)
-                enum_value = g_enum_get_value (enum_class, GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM);
-              else
+                enum_value = g_enum_get_value (enum_class, GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP);
+
+              if (layout == GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM ||
+                  layout == GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT)
                 enum_value = g_enum_get_value (enum_class, GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM);
+
+              if (layout == GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP ||
+                  layout == GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT)
+                enum_value = g_enum_get_value (enum_class, GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP);
             }
           else
             {
Index: modules/printbackends/cups/gtkprintbackendcups.c
===================================================================
--- modules/printbackends/cups/gtkprintbackendcups.c	(revision 22575)
+++ modules/printbackends/cups/gtkprintbackendcups.c	(working copy)
@@ -490,6 +490,57 @@
   gtk_cups_request_encode_option (request, key, value);
 }
 
+GtkNumberUpLayout rotate_number_up_layout_90_degrees (GtkNumberUpLayout layout)
+{
+  GtkNumberUpLayout result;
+
+  switch (layout)
+    {
+      case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM:
+        result = GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP:
+        result = GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM:
+        result = GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP:
+        result = GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT:
+        result = GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT:
+        result = GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT:
+        result = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
+        break;
+      case GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT:
+        result = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP;
+        break;
+    }
+
+  return result;
+}
+
+GtkNumberUpLayout rotate_number_up_layout_180_degrees (GtkNumberUpLayout layout)
+{
+  GtkNumberUpLayout result;
+  result = rotate_number_up_layout_90_degrees (layout);
+  result = rotate_number_up_layout_90_degrees (result);
+  return result;
+}
+
+GtkNumberUpLayout rotate_number_up_layout_270_degrees (GtkNumberUpLayout layout)
+{
+  GtkNumberUpLayout result;
+  result = rotate_number_up_layout_180_degrees (layout);
+  result = rotate_number_up_layout_90_degrees (result);
+  return result;
+}
+
 static void
 gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
                                      GtkPrintJob             *job,
@@ -3710,6 +3761,34 @@
       g_free (custom_name);
     }
 
+  if (gtk_print_settings_get_number_up (settings) > 1)
+    {
+      GtkNumberUpLayout  layout = gtk_print_settings_get_number_up_layout (settings);
+      GEnumClass        *enum_class;
+      GEnumValue        *enum_value;
+
+      switch (gtk_page_setup_get_orientation (page_setup))
+        {
+          case GTK_PAGE_ORIENTATION_PORTRAIT:
+            break;
+          case GTK_PAGE_ORIENTATION_LANDSCAPE:
+            layout = rotate_number_up_layout_90_degrees (layout);
+            break;
+          case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+            layout = rotate_number_up_layout_180_degrees (layout);
+            break;
+          case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+            layout = rotate_number_up_layout_270_degrees (layout);
+            break;
+        }
+
+      enum_class = g_type_class_ref (GTK_TYPE_NUMBER_UP_LAYOUT);
+      enum_value = g_enum_get_value (enum_class, layout);
+      if (enum_value != NULL)
+        gtk_print_settings_set (settings, "cups-number-up-layout", enum_value->value_nick);
+      g_type_class_unref (enum_class);
+    }
+
   print_job->rotate_to_orientation = TRUE;
 }
 
