Author: marcos
Date: 2008-03-13 22:40:11 -0700 (Thu, 13 Mar 2008)
New Revision: 8599

Modified:
   trunk/gs/src/gdevdjet.c
   trunk/gs/src/gdevdljm.c
Log:
Fixed duplexing for ljet3d and ljet4d devices; thanks to karsten@sengebusch.de for the changes.

Fixes bug 687531.

No regressions expected, since neither device is tested by the regression suite.



Modified: trunk/gs/src/gdevdjet.c
===================================================================
--- trunk/gs/src/gdevdjet.c	2008-03-13 07:18:46 UTC (rev 8598)
+++ trunk/gs/src/gdevdjet.c	2008-03-14 05:40:11 UTC (rev 8599)
@@ -425,7 +425,7 @@
     bool tumble=dev->Tumble;
 
     hpjet_make_init(pdev, init, "\033&l-180u36Z\033*r0F");
-    hpjet_make_init(pdev, even_init, "\033&l180u36Z\033*r0F");
+    sprintf(even_init, "\033&l180u36Z\033*r0F");
     return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
 					300, PCL_LJ3D_FEATURES, init, even_init, tumble);
 }
@@ -460,10 +460,22 @@
     gx_device_hpjet *dev = (gx_device_hpjet *)pdev;
     bool tumble=dev->Tumble;
 
+    /* Put out per-page initialization. */
+    /*
+       Modified by karsten@sengebusch.de
+       in duplex mode the sheet is alread in process, so there are some
+       commands which must not be sent to the printer for the 2nd page,
+       as this commands will cause the printer to eject the sheet with
+       only the 1st page printed. This commands are:
+       \033&l%dA (setting paper size)
+       \033&l%dH (setting paper tray)
+       in simplex mode we set this parameters for each page,
+       in duplex mode we set this parameters for each odd page
+       (paper tray is set by "hpjet_make_init")
+    */
     sprintf(base_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
     hpjet_make_init(pdev, init, base_init);
-    sprintf(even_base_init, "\033&l180u36Z\033*r0F\033&u%dD", dots_per_inch);
-    hpjet_make_init(pdev, even_init, even_base_init);
+    sprintf(even_init, "\033&l180u36Z\033*r0F\033&u%dD", dots_per_inch);
     return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
 					dots_per_inch, PCL_LJ4D_FEATURES,
 					init,even_init,tumble);
@@ -565,7 +577,10 @@
 	}
     }
     if (code>=0)
+    {
        code=param_read_bool(plist,"Tumble",&Tumble);
+       if (code != 0) Tumble = false; // default: no tumble
+    }
 
     if (code >= 0)
 	code = gdev_prn_put_params(pdev, plist);

Modified: trunk/gs/src/gdevdljm.c
===================================================================
--- trunk/gs/src/gdevdljm.c	2008-03-13 07:18:46 UTC (rev 8598)
+++ trunk/gs/src/gdevdljm.c	2008-03-14 05:40:11 UTC (rev 8599)
@@ -123,20 +123,36 @@
 	}
     }
     /* Put out per-page initialization. */
-    if (features & PCL_CAN_SET_PAPER_SIZE){ 
-        fprintf(prn_stream, "\033&l%dA", paper_size); 
-    } 
-    fputs("\033&l0o0l0E", prn_stream);
-    if ((features & PCL_HAS_DUPLEX) && dupset && dup)
-    {
+    /*
+       Modified by karsten@sengebusch.de
+       in duplex mode the sheet is alread in process, so there are some
+       commands which must not be sent to the printer for the 2nd page,
+       as this commands will cause the printer to eject the sheet with
+       only the 1st page printed. This commands are:
+       \033&l%dA (setting paper size)
+       \033&l%dH (setting paper tray)
+       in simplex mode we set this parameters for each page,
+       in duplex mode we set this parameters for each odd page
+    */
+    
+    if ((features & PCL_HAS_DUPLEX) && dupset && dup) {
        /* We are printing duplex, so change margins as needed */
-       if ((pdev->PageCount%2)==0)
+       if ((pdev->PageCount%2)==0) {
+          if (features & PCL_CAN_SET_PAPER_SIZE) { 
+              fprintf(prn_stream, "\033&l%dA", paper_size); 
+          } 
+          fputs("\033&l0o0l0E", prn_stream);
           fputs(odd_page_init, prn_stream);
-       else
+       } else
           fputs(even_page_init, prn_stream);
+    } else {
+        if (features & PCL_CAN_SET_PAPER_SIZE){  
+            fprintf(prn_stream, "\033&l%dA", paper_size); 
+        } 
+        fputs("\033&l0o0l0E", prn_stream);
+        fputs(odd_page_init, prn_stream);
     }
-    else
-        fputs(odd_page_init, prn_stream);
+    
     fprintf(prn_stream, "\033&l%dX", num_copies);	/* # of copies */
 
     /* End raster graphics, position cursor at top. */

_______________________________________________
gs-cvs mailing list
gs-cvs@ghostscript.com
http://www.ghostscript.com/mailman/listinfo/gs-cvs
