Index: plugins/excel/ms-excel-read.c
===================================================================
RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-excel-read.c,v
retrieving revision 1.664
diff -u -r1.664 ms-excel-read.c
--- plugins/excel/ms-excel-read.c	8 Jul 2005 19:20:56 -0000	1.664
+++ plugins/excel/ms-excel-read.c	11 Jul 2005 17:30:14 -0000
@@ -5694,6 +5694,8 @@
 		"xls-default-style",
 		excel_get_style_from_xf (esheet, excel_get_xf (esheet, 0)),
 		(GDestroyNotify) gnm_style_unref);
+        pi->valid = TRUE; 
+	
 	return TRUE;
 }
 
Index: plugins/excel/ms-excel-write.c
===================================================================
RCS file: /cvs/gnome/gnumeric/plugins/excel/ms-excel-write.c,v
retrieving revision 1.310
diff -u -r1.310 ms-excel-write.c
--- plugins/excel/ms-excel-write.c	30 Jun 2005 02:11:17 -0000	1.310
+++ plugins/excel/ms-excel-write.c	11 Jul 2005 17:30:16 -0000
@@ -3952,6 +3952,12 @@
 	pi = sheet->print_info;
 	g_return_if_fail (pi != NULL);
 
+	if (!pi->valid) {
+		/* Merge default print config into pi */
+		GnomePrintConfig *config = print_info_make_config (pi);
+		if (config)
+			gnome_print_config_unref (config);
+	}
 	ms_biff_put_2byte (bp, BIFF_CALCMODE, wb->recalc_auto ? 1 : 0);
 	ms_biff_put_2byte (bp, BIFF_CALCCOUNT, wb->iteration.max_number);
 	ms_biff_put_2byte (bp, BIFF_REFMODE, sheet->r1c1_addresses ? 0 : 1);
Index: src/print-info.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/print-info.c,v
retrieving revision 1.109
diff -u -r1.109 print-info.c
--- src/print-info.c	26 Apr 2005 21:26:54 -0000	1.109
+++ src/print-info.c	11 Jul 2005 17:30:22 -0000
@@ -275,6 +275,7 @@
 	pi->paper	  = NULL;
 	pi->paper_width	  = NULL;
 	pi->paper_height  = NULL;
+	pi->valid         = FALSE;
 	return pi;
 }
 
@@ -645,6 +646,8 @@
 	dst_pi->paper_width = g_strdup (src_pi->paper_width);
 	g_free (dst_pi->paper_height);
 	dst_pi->paper_height = g_strdup (src_pi->paper_height);
+	
+	dst_pi->valid        = src_pi->valid;
 
 	return dst_pi;
 }
@@ -768,11 +771,18 @@
 GnomePrintConfig *
 print_info_make_config (PrintInformation const *pi)
 {
-	GnomePrintConfig *res = (NULL != pi->gp_config_str)
-		? gnome_print_config_from_string (pi->gp_config_str, 0)
-		: ((NULL != gnm_app_prefs->printer_config)
-			? gnome_print_config_from_string (gnm_app_prefs->printer_config, 0)
-			: gnome_print_config_default ());
+	GnomePrintConfig *res;
+	
+	/* Lazy loading of default printer config */
+	if (!pi->valid && gnm_app_prefs->printer_config) {
+		res = gnome_print_config_from_string (
+			gnm_app_prefs->printer_config, 0);
+		print_info_load_config (pi, res);
+	} else if (pi->gp_config_str) {
+		res = gnome_print_config_from_string (pi->gp_config_str, 0);
+	} else {
+		res = gnome_print_config_default ();
+	}
 
 	if (NULL != pi->paper) {
 		gnome_print_config_set (res, GNOME_PRINT_KEY_PAPER_SIZE, pi->paper);
@@ -851,4 +861,5 @@
 			pi->orientation = PRINT_ORIENT_HORIZONTAL_UPSIDE_DOWN;
 		g_free (str);
 	}
+	pi->valid = TRUE;
 }
Index: src/print-info.h
===================================================================
RCS file: /cvs/gnome/gnumeric/src/print-info.h,v
retrieving revision 1.38
diff -u -r1.38 print-info.h
--- src/print-info.h	10 Dec 2004 22:21:26 -0000	1.38
+++ src/print-info.h	11 Jul 2005 17:30:22 -0000
@@ -64,6 +64,11 @@
 	GnmRange range;
 } PrintRepeatRange;
 
+/* Our GnomePrintConfig isn't initialized on startup due to CUPS' delay
+ * problems. So we can't initialize PrintInformation from the default 
+ * GnomePrintConfig, i.e. it is all zeros. Therefore we need a flag to tell
+ * if PrintInformation holds valid data.
+ */
 struct _PrintInformation {
 	PrintScaling     scaling;
 	PrintMargins     margins;
@@ -91,6 +96,7 @@
 	char		 *gp_config_str;
 	char		 *paper;
 	char		 *paper_width, *paper_height;
+	gboolean          valid; 
 };
 
 typedef enum {
Index: src/xml-io.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/xml-io.c,v
retrieving revision 1.471
diff -u -r1.471 xml-io.c
--- src/xml-io.c	26 Jun 2005 00:54:02 -0000	1.471
+++ src/xml-io.c	11 Jul 2005 17:30:26 -0000
@@ -1005,6 +1005,12 @@
 
 	g_return_val_if_fail (pi != NULL, NULL);
 
+	if (!pi->valid) {
+		/* Merge default print config into pi */
+		GnomePrintConfig *config = print_info_make_config (pi);
+		if (config)
+			gnome_print_config_unref (config);
+	}
 	print_info_get_margins (pi, &header, &footer, &left, &right);
 	cur = xmlNewDocNode (ctxt->doc, ctxt->ns, CC2XML ("PrintInformation"), NULL);
 
@@ -1261,6 +1267,7 @@
 		print_info_set_paper (pi, paper);
 		xmlFree (paper);
 	}
+	pi->valid = TRUE;
 }
 
 static char const *
Index: src/xml-sax-read.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/xml-sax-read.c,v
retrieving revision 1.158
diff -u -r1.158 xml-sax-read.c
--- src/xml-sax-read.c	26 Jun 2005 00:54:02 -0000	1.158
+++ src/xml-sax-read.c	11 Jul 2005 17:30:27 -0000
@@ -600,6 +600,7 @@
 	g_return_if_fail (state->sheet->print_info != NULL);
 
 	pi = state->sheet->print_info;
+	pi->valid = TRUE;
 	switch (gsf_state->node->user_data.v_int) {
 	case 0: xml_sax_print_margins_unit (state, attrs,
 			&pi->margins.top);
@@ -640,6 +641,7 @@
 	g_return_if_fail (state->sheet->print_info != NULL);
 
 	pi = state->sheet->print_info;
+	pi->valid = TRUE;
 	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
 		if (!strcmp (attrs[0], "type"))
 			pi->scaling.type = strcmp (attrs[1], "percentage")
@@ -1611,6 +1613,7 @@
 	g_return_if_fail (state->sheet != NULL);
 	g_return_if_fail (state->sheet->print_info != NULL);
 
+	state->sheet->print_info->valid = TRUE;
 	if (!strcmp (content, "portrait")) {
 		print_info_set_orientation (state->sheet->print_info, PRINT_ORIENT_VERTICAL);
 	} else if (!strcmp (content, "landscape")) {
@@ -1629,6 +1632,7 @@
 	g_return_if_fail (state->sheet != NULL);
 	g_return_if_fail (state->sheet->print_info != NULL);
 
+	state->sheet->print_info->valid = TRUE;
 	print_info_set_paper (state->sheet->print_info, content);
 }
 
Index: src/xml-sax-write.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/xml-sax-write.c,v
retrieving revision 1.48
diff -u -r1.48 xml-sax-write.c
--- src/xml-sax-write.c	26 Jun 2005 00:54:02 -0000	1.48
+++ src/xml-sax-write.c	11 Jul 2005 17:30:28 -0000
@@ -283,6 +283,13 @@
 
 	g_return_if_fail (pi != NULL);
 
+	if (!pi->valid) {
+		/* Merge default print config into pi */
+		GnomePrintConfig *config = print_info_make_config (pi);
+		if (config)
+			gnome_print_config_unref (config);
+	}
+
 	gsf_xml_out_start_element (state->output, GNM "PrintInformation");
 
 	gsf_xml_out_start_element (state->output, GNM "Margins");
