Index: gtk/gtk.symbols
===================================================================
--- gtk/gtk.symbols	(revision 21724)
+++ gtk/gtk.symbols	(working copy)
@@ -2974,6 +2974,11 @@
 gtk_print_settings_set_number_up_layout
 gtk_print_settings_get_resolution
 gtk_print_settings_set_resolution
+gtk_print_settings_get_resolution_x
+gtk_print_settings_get_resolution_y
+gtk_print_settings_set_resolution_xy
+gtk_print_settings_get_printer_lpi
+gtk_print_settings_set_printer_lpi
 gtk_print_settings_get_scale
 gtk_print_settings_set_scale
 gtk_print_settings_get_print_pages
Index: gtk/gtkprintsettings.c
===================================================================
--- gtk/gtkprintsettings.c	(revision 21724)
+++ gtk/gtkprintsettings.c	(working copy)
@@ -1193,7 +1193,9 @@
  * @settings: a #GtkPrintSettings
  * @resolution: the resolution in dpi
  * 
- * Sets the value of %GTK_PRINT_SETTINGS_RESOLUTION.
+ * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
+ * %GTK_PRINT_SETTINGS_RESOLUTION_X and 
+ * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
  * 
  * Since: 2.10
  */
@@ -1203,9 +1205,103 @@
 {
   gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION,
 			      resolution);
+  gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_X,
+			      resolution);
+  gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_Y,
+			      resolution);
 }
 
 /**
+ * gtk_print_settings_get_resolution_x:
+ * @settings: a #GtkPrintSettings
+ * 
+ * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.
+ * 
+ * Return value: the horizontal resolution in dpi
+ *
+ * Since: 2.16
+ */
+gint
+gtk_print_settings_get_resolution_x (GtkPrintSettings *settings)
+{
+  return gtk_print_settings_get_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_X);
+}
+
+/**
+ * gtk_print_settings_get_resolution_y:
+ * @settings: a #GtkPrintSettings
+ * 
+ * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.
+ * 
+ * Return value: the vertical resolution in dpi
+ *
+ * Since: 2.16
+ */
+gint
+gtk_print_settings_get_resolution_y (GtkPrintSettings *settings)
+{
+  return gtk_print_settings_get_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_Y);
+}
+
+/**
+ * gtk_print_settings_set_resolution_xy:
+ * @settings: a #GtkPrintSettings
+ * @resolution_x: the horizontal resolution in dpi
+ * @resolution_y: the vertical resolution in dpi
+ * 
+ * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
+ * %GTK_PRINT_SETTINGS_RESOLUTION_X and
+ * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
+ * 
+ * Since: 2.16
+ */
+void
+gtk_print_settings_set_resolution_xy (GtkPrintSettings *settings,
+				      gint              resolution_x,
+				      gint              resolution_y)
+{
+  gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_X,
+			      resolution_x);
+  gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION_Y,
+			      resolution_y);
+  gtk_print_settings_set_int (settings, GTK_PRINT_SETTINGS_RESOLUTION,
+			      resolution_x);
+}
+
+/**
+ * gtk_print_settings_get_printer_lpi:
+ * @settings: a #GtkPrintSettings
+ * 
+ * Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
+ * 
+ * Return value: the resolution in lpi (lines per inch)
+ *
+ * Since: 2.16
+ */
+gdouble
+gtk_print_settings_get_printer_lpi (GtkPrintSettings *settings)
+{
+  return gtk_print_settings_get_double (settings, GTK_PRINT_SETTINGS_PRINTER_LPI);
+}
+
+/**
+ * gtk_print_settings_set_printer_lpi:
+ * @settings: a #GtkPrintSettings
+ * @resolution: the resolution in lpi (lines per inch)
+ * 
+ * Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI
+ * 
+ * Since: 2.16
+ */
+void
+gtk_print_settings_set_printer_lpi (GtkPrintSettings *settings,
+				    gdouble           lpi)
+{
+  gtk_print_settings_set_double (settings, GTK_PRINT_SETTINGS_PRINTER_LPI,
+			         lpi);
+}
+
+/**
  * gtk_print_settings_get_scale:
  * @settings: a #GtkPrintSettings
  * 
Index: gtk/gtkprintsettings.h
===================================================================
--- gtk/gtkprintsettings.h	(revision 21724)
+++ gtk/gtkprintsettings.h	(working copy)
@@ -133,6 +133,9 @@
 #define GTK_PRINT_SETTINGS_NUMBER_UP        "number-up"
 #define GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT "number-up-layout"
 #define GTK_PRINT_SETTINGS_OUTPUT_BIN       "output-bin"
+#define GTK_PRINT_SETTINGS_RESOLUTION_X     "resolution-x"
+#define GTK_PRINT_SETTINGS_RESOLUTION_Y     "resolution-y"
+#define GTK_PRINT_SETTINGS_PRINTER_LPI      "printer-lpi"
 
 #define GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT  "output-file-format"
 #define GTK_PRINT_SETTINGS_OUTPUT_URI          "output-uri"
@@ -188,6 +191,14 @@
 gint                  gtk_print_settings_get_resolution        (GtkPrintSettings   *settings);
 void                  gtk_print_settings_set_resolution        (GtkPrintSettings   *settings,
 								gint                resolution);
+gint                  gtk_print_settings_get_resolution_x      (GtkPrintSettings   *settings);
+gint                  gtk_print_settings_get_resolution_y      (GtkPrintSettings   *settings);
+void                  gtk_print_settings_set_resolution_xy     (GtkPrintSettings   *settings,
+								gint                resolution_x,
+								gint                resolution_y);
+gdouble               gtk_print_settings_get_printer_lpi       (GtkPrintSettings   *settings);
+void                  gtk_print_settings_set_printer_lpi       (GtkPrintSettings   *settings,
+								gdouble             lpi);
 gdouble               gtk_print_settings_get_scale             (GtkPrintSettings   *settings);
 void                  gtk_print_settings_set_scale             (GtkPrintSettings   *settings,
 								gdouble             scale);
Index: docs/reference/gtk/gtk-sections.txt
===================================================================
--- docs/reference/gtk/gtk-sections.txt	(revision 21724)
+++ docs/reference/gtk/gtk-sections.txt	(working copy)
@@ -6617,6 +6617,14 @@
 GTK_PRINT_SETTINGS_RESOLUTION
 gtk_print_settings_get_resolution
 gtk_print_settings_set_resolution
+gtk_print_settings_set_resolution_xy
+GTK_PRINT_SETTINGS_RESOLUTION_X
+gtk_print_settings_get_resolution_x
+GTK_PRINT_SETTINGS_RESOLUTION_Y
+gtk_print_settings_get_resolution_y
+GTK_PRINT_SETTINGS_PRINTER_LPI
+gtk_print_settings_get_printer_lpi
+gtk_print_settings_set_printer_lpi
 GTK_PRINT_SETTINGS_SCALE
 gtk_print_settings_get_scale
 gtk_print_settings_set_scale
Index: modules/printbackends/file/gtkprintbackendfile.c
===================================================================
--- modules/printbackends/file/gtkprintbackendfile.c	(revision 21724)
+++ modules/printbackends/file/gtkprintbackendfile.c	(working copy)
@@ -306,9 +306,13 @@
   else
     surface = cairo_pdf_surface_create_for_stream (_cairo_write, cache_io, width, height);
 
-  /* TODO: DPI from settings object? */
-  cairo_surface_set_fallback_resolution (surface, 300, 300);
+  if (gtk_print_settings_get_printer_lpi (settings) == 0.0)
+    gtk_print_settings_set_printer_lpi (settings, 150.0);
 
+  cairo_surface_set_fallback_resolution (surface,
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings),
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings));
+
   return surface;
 }
 
Index: modules/printbackends/test/gtkprintbackendtest.c
===================================================================
--- modules/printbackends/test/gtkprintbackendtest.c	(revision 21724)
+++ modules/printbackends/test/gtkprintbackendtest.c	(working copy)
@@ -306,9 +306,13 @@
   else
     surface = cairo_pdf_surface_create_for_stream (_cairo_write, cache_io, width, height);
 
-  /* TODO: DPI from settings object? */
-  cairo_surface_set_fallback_resolution (surface, 300, 300);
+  if (gtk_print_settings_get_printer_lpi (settings) == 0.0)
+    gtk_print_settings_set_printer_lpi (settings, 150.0);
 
+  cairo_surface_set_fallback_resolution (surface,
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings),
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings));
+
   return surface;
 }
 
Index: modules/printbackends/cups/gtkprintbackendcups.c
===================================================================
--- modules/printbackends/cups/gtkprintbackendcups.c	(revision 21724)
+++ modules/printbackends/cups/gtkprintbackendcups.c	(working copy)
@@ -316,6 +316,10 @@
   cairo_surface_t *surface; 
   ppd_file_t      *ppd_file = NULL;
   ppd_attr_t      *ppd_attr = NULL;
+  ppd_attr_t      *ppd_attr_res = NULL;
+  ppd_attr_t      *ppd_attr_screen_freq = NULL;
+  ppd_attr_t      *ppd_attr_res_screen_freq = NULL;
+  gchar           *res_string = NULL;
   int              level = 2;
  
   /* TODO: check if it is a ps or pdf printer */
@@ -330,7 +334,58 @@
 
       if (ppd_attr != NULL)
         level = atoi (ppd_attr->value);
+
+      if (gtk_print_settings_get_resolution (settings) == 0)
+        {
+          ppd_attr_res = ppdFindAttr (ppd_file, "DefaultResolution", NULL);
+
+          if (ppd_attr_res != NULL)
+            {
+              int res, res_x, res_y;
+
+              if (sscanf (ppd_attr_res->value, "%dx%ddpi", &res_x, &res_y) == 2)
+                {
+                  if (res_x != 0 && res_y != 0)
+                    gtk_print_settings_set_resolution_xy (settings, res_x, res_y);
+                }
+              else if (sscanf (ppd_attr_res->value, "%ddpi", &res) == 1)
+                {
+                  if (res != 0)
+                    gtk_print_settings_set_resolution (settings, res);
+                }
+              else
+                gtk_print_settings_set_resolution (settings, 300);
+            }
+        }
+
+      res_string = g_strdup_printf ("%ddpi", 
+                                    gtk_print_settings_get_resolution (settings));
+      ppd_attr_res_screen_freq = ppdFindAttr (ppd_file, "ResScreenFreq", res_string);
+      g_free (res_string);
+
+      if (ppd_attr_res_screen_freq == NULL)
+        {
+          res_string = g_strdup_printf ("%dx%ddpi", 
+                                        gtk_print_settings_get_resolution_x (settings),
+                                        gtk_print_settings_get_resolution_y (settings));
+          ppd_attr_res_screen_freq = ppdFindAttr (ppd_file, "ResScreenFreq", res_string);
+          g_free (res_string);
+        }
+
+      ppd_attr_screen_freq = ppdFindAttr (ppd_file, "ScreenFreq", NULL);
+
+      if (ppd_attr_res_screen_freq != NULL)
+        gtk_print_settings_set_printer_lpi (settings, atof (ppd_attr_res_screen_freq->value));
+      else if (ppd_attr_screen_freq != NULL)
+        gtk_print_settings_set_printer_lpi (settings, atof (ppd_attr_screen_freq->value));
+      else
+        gtk_print_settings_set_printer_lpi (settings, 150.0);
     }
+  else
+    {
+      gtk_print_settings_set_resolution (settings, 300);
+      gtk_print_settings_set_printer_lpi (settings, 150.0);
+    }
 
   if (level == 2)
     cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_2);
@@ -338,8 +393,9 @@
   if (level == 3)
     cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_3);
 
-  /* TODO: DPI from settings object? */
-  cairo_surface_set_fallback_resolution (surface, 300, 300);
+  cairo_surface_set_fallback_resolution (surface,
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings),
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings));
 
   return surface;
 }
@@ -3282,7 +3338,16 @@
       else
 	{
 	  int res = gtk_print_settings_get_resolution (settings);
-	  if (res != 0)
+	  int res_x = gtk_print_settings_get_resolution_x (settings);
+	  int res_y = gtk_print_settings_get_resolution_y (settings);
+
+          if (res_x != res_y)
+            {
+	      value = g_strdup_printf ("%dx%ddpi", res_x, res_y);
+	      gtk_printer_option_set (option, value);
+	      g_free (value);
+            }
+          else if (res != 0)
 	    {
 	      value = g_strdup_printf ("%ddpi", res);
 	      gtk_printer_option_set (option, value);
@@ -3371,10 +3436,19 @@
 			    settings, GTK_PRINT_SETTINGS_QUALITY, "OutputMode");
   else if (strcmp (option->name, "cups-Resolution") == 0)
     {
-      int res = atoi (value);
-      /* TODO: What if resolution is on XXXxYYYdpi form? */
-      if (res != 0)
-	gtk_print_settings_set_resolution (settings, res);
+      int res, res_x, res_y;
+
+      if (sscanf (value, "%dx%ddpi", &res_x, &res_y) == 2)
+        {
+          if (res_x != 0 && res_y != 0)
+            gtk_print_settings_set_resolution_xy (settings, res_x, res_y);
+        }
+      else if (sscanf (value, "%ddpi", &res) == 1)
+        {
+          if (res != 0)
+            gtk_print_settings_set_resolution (settings, res);
+        }
+
       gtk_print_settings_set (settings, option->name, value);
     }
   else if (strcmp (option->name, "gtk-paper-type") == 0)
Index: modules/printbackends/lpr/gtkprintbackendlpr.c
===================================================================
--- modules/printbackends/lpr/gtkprintbackendlpr.c	(revision 21724)
+++ modules/printbackends/lpr/gtkprintbackendlpr.c	(working copy)
@@ -211,9 +211,13 @@
   
   surface = cairo_ps_surface_create_for_stream (_cairo_write, cache_io, width, height);
 
-  /* TODO: DPI from settings object? */
-  cairo_surface_set_fallback_resolution (surface, 300, 300);
+  if (gtk_print_settings_get_printer_lpi (settings) == 0.0)
+    gtk_print_settings_set_printer_lpi (settings, 150.0);
 
+  cairo_surface_set_fallback_resolution (surface,
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings),
+                                         2.0 * gtk_print_settings_get_printer_lpi (settings));
+
   return surface;
 }
 
