diff --git a/gtk/gtkprintsettings.h b/gtk/gtkprintsettings.h
index bdf62f7..eecf603 100644
--- a/gtk/gtkprintsettings.h
+++ b/gtk/gtkprintsettings.h
@@ -139,6 +139,8 @@ void              gtk_print_settings_set_int                 (GtkPrintSettings
 
 #define GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT  "output-file-format"
 #define GTK_PRINT_SETTINGS_OUTPUT_URI          "output-uri"
+#define GTK_PRINT_SETTINGS_OUTPUT_DIR_URI      "output-dir-uri"
+#define GTK_PRINT_SETTINGS_OUTPUT_BASENAME     "output-basename"
 
 #define GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION "win32-driver-version"
 #define GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA   "win32-driver-extra"
diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c
index 20d157d..3175ed0 100644
--- a/modules/printbackends/file/gtkprintbackendfile.c
+++ b/modules/printbackends/file/gtkprintbackendfile.c
@@ -221,8 +221,9 @@ output_file_from_settings (GtkPrintSettings *settings,
 
   if (uri == NULL)
     { 
-      const gchar *extension;
+      const gchar *extension, *basename;
       gchar *name, *locale_name, *path;
+      gchar *uri_dir = NULL;
 
       if (default_format)
         extension = default_format;
@@ -245,22 +246,49 @@ output_file_from_settings (GtkPrintSettings *settings,
                 break;
             }
         }
- 
-      /* default filename used for print-to-file */ 
-      name = g_strdup_printf (_("output.%s"), extension);
+      
+      basename = g_strdup (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME));
+      if (basename == NULL)
+        {
+          /* default filename used for print-to-file */
+          name = g_strdup_printf (_("output.%s"), extension);
+        }
+      else 
+        {
+          name = g_strdup_printf ("%s.%s", basename, extension);
+        }
       locale_name = g_filename_from_utf8 (name, -1, NULL, NULL, NULL);
       g_free (name);
+      g_free (basename);
 
       if (locale_name != NULL)
-        {
-	  gchar *current_dir = g_get_current_dir ();
-          path = g_build_filename (current_dir, locale_name, NULL);
+        {      
+          uri_dir = g_strdup (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_DIR_URI));
+          if (uri_dir == NULL)
+            {
+              const gchar *document_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+
+              if (document_dir == NULL)
+                {
+                  gchar *current_dir = g_get_current_dir ();
+                  path = g_build_filename (current_dir, locale_name, NULL);
+                  g_free (current_dir);
+                }
+              else
+                path = g_build_filename (document_dir, locale_name, NULL);
+
+              uri = g_filename_to_uri (path, NULL, NULL); 
+              g_free (path);
+
+	    }
+          else
+            {
+              uri = g_build_filename (uri_dir, locale_name, NULL);
+            }
+ 
           g_free (locale_name);
 
-          uri = g_filename_to_uri (path, NULL, NULL);
-          g_free (path);
-	  g_free (current_dir);
-	}
+        }
     }
 
   return uri;
