--- a/devices/gdevdjet.c
+++ b/devices/gdevdjet.c
@@ -443,6 +443,8 @@
     char init[80];
 
     gs_sprintf(base_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
+    if (gdev_pcl_page_orientation((gx_device *) pdev) == PAGE_ORIENTATION_LANDSCAPE)
+        gs_sprintf(base_init, "\033&l0u140Z\033*r0F\033&u%dD", dots_per_inch);
     hpjet_make_init(pdev, init, base_init);
 
     return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
--- a/devices/gdevdljm.c
+++ b/devices/gdevdljm.c
@@ -82,6 +82,7 @@
     int penalty_from2to3 = strlen(from2to3);
     int penalty_from3to2 = strlen(from3to2);
     int paper_size = gdev_pcl_paper_size((gx_device *) pdev);
+    int page_orientation = gdev_pcl_page_orientation((gx_device *) pdev);
     int code = 0;
     bool dup = pdev->Duplex;
     bool dupset = pdev->Duplex_set >= 0;
@@ -109,6 +110,7 @@
         fputs("\033E", prn_stream);	/* reset printer */
         /* If the printer supports it, set the paper size */
         /* based on the actual requested size. */
+        fprintf(prn_stream, "\033&l%dO", page_orientation);
         if (features & PCL_CAN_SET_PAPER_SIZE) {
             fprintf(prn_stream, "\033&l%dA", paper_size);
         }
@@ -140,18 +142,20 @@
     if ((features & PCL_HAS_DUPLEX) && dupset && dup) {
        /* We are printing duplex, so change margins as needed */
        if (( (pdev->PageCount/num_copies)%2)==0) {
+          fprintf(prn_stream, "\033&l%dO", page_orientation);
           if (features & PCL_CAN_SET_PAPER_SIZE) {
               fprintf(prn_stream, "\033&l%dA", paper_size);
           }
-          fputs("\033&l0o0l0E", prn_stream);
+          fputs("\033&l0l0E", prn_stream);
           fputs(odd_page_init, prn_stream);
        } else
           fputs(even_page_init, prn_stream);
     } else {
+        fprintf(prn_stream, "\033&l%dO", page_orientation);
         if (features & PCL_CAN_SET_PAPER_SIZE){
             fprintf(prn_stream, "\033&l%dA", paper_size);
         }
-        fputs("\033&l0o0l0E", prn_stream);
+        fputs("\033&l0l0E", prn_stream);
         fputs(odd_page_init, prn_stream);
     }
 
--- a/devices/gdevpcl.c
+++ b/devices/gdevpcl.c
@@ -34,6 +34,12 @@
     float new_width_difference, new_height_difference;
     int code = PAPER_SIZE_LETTER;
 
+    if (dev->width > dev->height) {
+        /* Landscape orientation, switch width and height to find paper size */
+        width_inches = dev->height / dev->y_pixels_per_inch;
+        height_inches = dev->width / dev->x_pixels_per_inch;
+    }
+
     /* Since we're telling the printer when to eject and start a new
        page, the paper height doesn't matter a great deal, as long as
        we ensure that it's at least as high as we want our pages to
@@ -88,6 +94,18 @@
     return code;
 }
 
+/* ------ Get page orientation ------ */
+
+/* Get the page orientation, based on width and height. */
+int
+gdev_pcl_page_orientation(gx_device * dev)
+{
+    if (dev->height >= dev->width)
+        return PAGE_ORIENTATION_PORTRAIT;
+    else
+        return PAGE_ORIENTATION_LANDSCAPE;
+}
+
 /* ------ Color mapping ------ */
 
 /* The PaintJet and DeskJet 500C use additive colors in separate planes. */
--- a/devices/gdevpcl.h
+++ b/devices/gdevpcl.h
@@ -50,6 +50,12 @@
 /* Get the paper size code, based on width and height. */
 int gdev_pcl_paper_size(gx_device *);
 
+#define PAGE_ORIENTATION_PORTRAIT     0
+#define PAGE_ORIENTATION_LANDSCAPE    1
+
+/* Get the page orientation, based on width and height. */
+int gdev_pcl_page_orientation(gx_device * dev);
+
 /* Color mapping procedures for 3-bit-per-pixel RGB printers */
 dev_proc_map_rgb_color(gdev_pcl_3bit_map_rgb_color);
 dev_proc_map_color_rgb(gdev_pcl_3bit_map_color_rgb);
