]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.6svn-r10006.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 20 Sep 2011 18:40:57 +0000 (18:40 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 20 Sep 2011 18:40:57 +0000 (18:40 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3427 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-1.5.txt
cups/http-addrlist.c
cups/http.c
cups/request.c
filter/raster.c
filter/rastertopwg.c

index 4416722c3e477c24f4b3643b25754906e7605f26..70e96810920161a0fbc9ba5e4bf091dcd3fca09f 100644 (file)
@@ -4,6 +4,8 @@ CHANGES-1.5.txt
 CHANGES IN CUPS V1.5.1
 
        - Documentation updates (STR #3885)
+       - Updated the PWG raster support to match the current draft
+         specification.
        - Fixed some IPP conformance issues in the scheduler.
        - Added ipptool support for repeating requests.
        - Added IPP/2.2 conformance tests and greatly improved the IPP/1.1
index 3478f05b4ba642bcac4b49af0b4c3678159ac4f6..f0658d2135344da9f2e83428b89e70a8a42af1c2 100644 (file)
@@ -169,7 +169,7 @@ httpAddrConnect(
   }
 
   if (!addrlist)
-    _cupsSetError(IPP_SERVICE_UNAVAILABLE, _("Unable to connect to server"), 1);
+    _cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno), 0);
 
   return (addrlist);
 }
index 8c44452a17bc0735013955d1a34d4247ee427601..d5dfd71e095dda31611407f565ca47edab0bc7d6 100644 (file)
@@ -2327,6 +2327,7 @@ httpReconnect(http_t *http)               /* I - Connection to server */
   http->hostaddr = &(addr->addr);
   http->error    = 0;
   http->status   = HTTP_CONTINUE;
+  http->state    = HTTP_WAITING;
 
 #ifdef HAVE_SSL
   if (http->encryption == HTTP_ENCRYPT_ALWAYS)
@@ -4005,6 +4006,18 @@ http_setup_ssl(http_t *http)             /* I - Connection to server */
   }
 #    endif /* HAVE_SSLSETPROTOCOLVERSIONMAX */
 
+ /*
+  * In general, don't verify certificates since things like the common name
+  * often do not match...
+  */
+
+  if (!error)
+  {
+    error = SSLSetEnableCertVerify(http->tls, false);
+    DEBUG_printf(("4http_setup_ssl: SSLSetEnableCertVerify, error=%d",
+                  (int)error));
+  }
+
 #    ifdef HAVE_SECCERTIFICATECOPYDATA
   if (!error)
   {
@@ -4030,20 +4043,18 @@ http_setup_ssl(http_t *http)            /* I - Connection to server */
 
   if (!error && cg->server_cert_cb != NULL)
   {
-    error = SSLSetEnableCertVerify(http->tls, false);
-    DEBUG_printf(("4http_setup_ssl: SSLSetEnableCertVerify, error=%d",
-                  (int)error));
-
-    if (!error)
-    {
-      error = SSLSetSessionOption(http->tls,
-                                 kSSLSessionOptionBreakOnServerAuth, true);
-      DEBUG_printf(("4http_setup_ssl: kSSLSessionOptionBreakOnServerAuth, "
-                    "error=%d", (int)error));
-    }
+    error = SSLSetSessionOption(http->tls,
+                               kSSLSessionOptionBreakOnServerAuth, true);
+    DEBUG_printf(("4http_setup_ssl: kSSLSessionOptionBreakOnServerAuth, "
+                 "error=%d", (int)error));
   }
 #    endif /* HAVE_SECCERTIFICATECOPYDATA */
 
+ /*
+  * Let the server know which hostname/domain we are trying to connect to
+  * in case it wants to serve up a certificate with a matching common name.
+  */
+
   if (!error)
   {
     hostname = httpAddrLocalhost(http->hostaddr) ? "localhost" : http->hostname;
@@ -4086,8 +4097,8 @@ http_setup_ssl(http_t *http)              /* I - Connection to server */
                httpFreeCredentials(credentials);
              }
 
-             DEBUG_printf(("4http_setup_ssl: Server certificate callback returned "
-                           "%d.", (int)error));
+             DEBUG_printf(("4http_setup_ssl: Server certificate callback "
+                           "returned %d.", (int)error));
            }
            break;
 
index f0d3e6581c2963fcf7adb8b8ec06b8d47a27dc3f..1f87e77f650c23753dcc6c8928715198a2ed3ea2 100644 (file)
@@ -635,9 +635,14 @@ cupsSendRequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
 
   if (http->state == HTTP_GET_SEND ||
       http->state == HTTP_POST_SEND)
+  {
+    DEBUG_puts("2cupsSendRequest: Flush prior response.");
     httpFlush(http);
+  }
   else if (http->state != HTTP_WAITING)
   {
+    DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), bailing.",
+                  http->state));
     _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
     return (HTTP_ERROR);
@@ -654,7 +659,7 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
       !httpAddrLocalhost(http->hostaddr) && !http->tls &&
       httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
   {
-    _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+    DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
     return (HTTP_SERVICE_UNAVAILABLE);
   }
 #endif /* HAVE_SSL */
@@ -664,11 +669,15 @@ cupsSendRequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
   */
 
   if (!_cups_strcasecmp(http->fields[HTTP_FIELD_CONNECTION], "close"))
+  {
+    DEBUG_puts("2cupsSendRequest: Connection: close");
+    httpClearFields(http);
     if (httpReconnect(http))
     {
-      _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+      DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
       return (HTTP_SERVICE_UNAVAILABLE);
     }
+  }
 
  /*
   * Loop until we can send the request without authorization problems.
@@ -713,9 +722,10 @@ cupsSendRequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
 
     if (httpPost(http, resource))
     {
+      DEBUG_puts("2cupsSendRequest: POST failed, reconnecting.");
       if (httpReconnect(http))
       {
-        _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+        DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
         return (HTTP_SERVICE_UNAVAILABLE);
       }
       else
@@ -746,6 +756,8 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
 
     if (state == IPP_ERROR)
     {
+      DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
+
       http->status = HTTP_ERROR;
       http->state  = HTTP_WAITING;
 
@@ -793,15 +805,21 @@ cupsSendRequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
       case HTTP_ERROR :
       case HTTP_CONTINUE :
       case HTTP_OK :
+          DEBUG_printf(("1cupsSendRequest: Returning %d.", status));
           return (status);
 
       case HTTP_UNAUTHORIZED :
           if (cupsDoAuthentication(http, "POST", resource))
+         {
+            DEBUG_puts("1cupsSendRequest: Returning HTTP_AUTHORIZATION_CANCELED.");
            return (HTTP_AUTHORIZATION_CANCELED);
+         }
+
+          DEBUG_puts("2cupsSendRequest: Reconnecting after HTTP_UNAUTHORIZED.");
 
          if (httpReconnect(http))
          {
-           _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+           DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
            return (HTTP_SERVICE_UNAVAILABLE);
          }
          break;
@@ -813,15 +831,19 @@ cupsSendRequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
          * encryption...
          */
 
+          DEBUG_puts("2cupsSendRequest: Reconnecting after "
+                    "HTTP_UPGRADE_REQUIRED.");
+
          if (httpReconnect(http))
          {
-           _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+           DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
            return (HTTP_SERVICE_UNAVAILABLE);
          }
 
+         DEBUG_puts("2cupsSendRequest: Upgrading to TLS.");
          if (httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
          {
-           _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+           DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
            return (HTTP_SERVICE_UNAVAILABLE);
          }
          break;
@@ -834,9 +856,12 @@ cupsSendRequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
 
          expect = (http_status_t)0;
 
+          DEBUG_puts("2cupsSendRequest: Reconnecting after "
+                    "HTTP_EXPECTATION_FAILED.");
+
          if (httpReconnect(http))
          {
-           _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+           DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
            return (HTTP_SERVICE_UNAVAILABLE);
          }
          break;
index bd08386472dba33bb83aa7ca00983351f1b1dc1b..bb5725206b2c0e63503ea808788221f639ed765e 100644 (file)
@@ -560,22 +560,79 @@ cupsRasterWriteHeader(
   if (r->mode == CUPS_RASTER_WRITE_PWG)
   {
    /*
-    * PWG raster data is always network byte order with most of the page header
+    * PWG raster data is always network byte order with much of the page header
     * zeroed.
     */
 
     cups_page_header2_t        fh;             /* File page header */
 
     memset(&fh, 0, sizeof(fh));
-    fh.HWResolution[0]  = htonl(r->header.HWResolution[0]);
-    fh.HWResolution[1]  = htonl(r->header.HWResolution[1]);
-    fh.cupsWidth        = htonl(r->header.cupsWidth);
-    fh.cupsHeight       = htonl(r->header.cupsHeight);
-    fh.cupsBitsPerColor = htonl(r->header.cupsBitsPerColor);
-    fh.cupsBitsPerPixel = htonl(r->header.cupsBitsPerPixel);
-    fh.cupsBytesPerLine = htonl(r->header.cupsBytesPerLine);
-    fh.cupsColorOrder   = htonl(r->header.cupsColorOrder);
-    fh.cupsColorSpace   = htonl(r->header.cupsColorSpace);
+
+    strlcpy(fh.MediaClass, "PwgRaster", sizeof(fh.MediaClass));
+                                       /* PwgRaster */
+    strlcpy(fh.MediaColor, r->header.MediaColor, sizeof(fh.MediaColor));
+    strlcpy(fh.MediaType, r->header.MediaType, sizeof(fh.MediaType));
+    strlcpy(fh.OutputType, r->header.OutputType, sizeof(fh.OutputType));
+                                       /* PrintContentType */
+
+    fh.CutMedia              = htonl(r->header.CutMedia);
+    fh.Duplex                = htonl(r->header.Duplex);
+    fh.HWResolution[0]       = htonl(r->header.HWResolution[0]);
+    fh.HWResolution[1]       = htonl(r->header.HWResolution[1]);
+    fh.ImagingBoundingBox[0] = htonl(r->header.ImagingBoundingBox[0]);
+    fh.ImagingBoundingBox[1] = htonl(r->header.ImagingBoundingBox[1]);
+    fh.ImagingBoundingBox[2] = htonl(r->header.ImagingBoundingBox[2]);
+    fh.ImagingBoundingBox[3] = htonl(r->header.ImagingBoundingBox[3]);
+    fh.InsertSheet           = htonl(r->header.InsertSheet);
+    fh.Jog                   = htonl(r->header.Jog);
+    fh.LeadingEdge           = htonl(r->header.LeadingEdge);
+    fh.ManualFeed            = htonl(r->header.ManualFeed);
+    fh.MediaPosition         = htonl(r->header.MediaPosition);
+    fh.MediaWeight           = htonl(r->header.MediaWeight);
+    fh.NumCopies             = htonl(r->header.NumCopies);
+    fh.Orientation           = htonl(r->header.Orientation);
+    fh.PageSize[0]           = htonl(r->header.PageSize[0]);
+    fh.PageSize[1]           = htonl(r->header.PageSize[1]);
+    fh.Tumble                = htonl(r->header.Tumble);
+    fh.cupsWidth             = htonl(r->header.cupsWidth);
+    fh.cupsHeight            = htonl(r->header.cupsHeight);
+    fh.cupsBitsPerColor      = htonl(r->header.cupsBitsPerColor);
+    fh.cupsBitsPerPixel      = htonl(r->header.cupsBitsPerPixel);
+    fh.cupsBytesPerLine      = htonl(r->header.cupsBytesPerLine);
+    fh.cupsColorOrder        = htonl(r->header.cupsColorOrder);
+    fh.cupsColorSpace        = htonl(r->header.cupsColorSpace);
+    fh.cupsNumColors         = htonl(r->header.cupsNumColors);
+    fh.cupsInteger[0]        = htonl(r->header.cupsInteger[0]);
+                                       /* TotalPageCount */
+    fh.cupsInteger[1]        = htonl(r->header.cupsInteger[1]);
+                                       /* CrossFeedTransform */
+    fh.cupsInteger[2]        = htonl(r->header.cupsInteger[2]);
+                                       /* FeedTransform */
+    fh.cupsInteger[3]        = htonl(r->header.cupsInteger[3]);
+                                       /* ImageBoxLeft */
+    fh.cupsInteger[4]        = htonl(r->header.cupsInteger[4]);
+                                       /* ImageBoxTop */
+    fh.cupsInteger[5]        = htonl(r->header.cupsInteger[5]);
+                                       /* ImageBoxRight */
+    fh.cupsInteger[6]        = htonl(r->header.cupsInteger[6]);
+                                       /* ImageBoxBottom */
+    fh.cupsInteger[7]        = htonl(r->header.cupsInteger[7]);
+                                       /* BlackPrimary */
+    fh.cupsInteger[8]        = htonl(r->header.cupsInteger[8]);
+                                       /* PrintQuality */
+    fh.cupsInteger[14]       = htonl(r->header.cupsInteger[14]);
+                                       /* VendorIdentifier */
+    fh.cupsInteger[15]       = htonl(r->header.cupsInteger[15]);
+                                       /* VendorLength */
+
+    memcpy(fh.cupsReal, r->header.cupsReal,
+           sizeof(fh.cupsReal) + sizeof(fh.cupsString));
+                                       /* VendorData */
+
+    strlcpy(fh.cupsRenderingIntent, r->header.cupsRenderingIntent,
+            sizeof(fh.cupsRenderingIntent));
+    strlcpy(fh.cupsPageSizeName, r->header.cupsPageSizeName,
+            sizeof(fh.cupsPageSizeName));
 
     return (cups_raster_io(r, (unsigned char *)&fh, sizeof(fh)) == sizeof(fh));
   }
index 716603a7f625f8bdd0929c4c60affb99972fbc01..622aa605ab0985f2e5f6cf61eaeadb5e87374be4 100644 (file)
  * Include necessary headers...
  */
 
-#include <cups/cups.h>
-#include <cups/language-private.h>
+#include <cups/cups-private.h>
 #include <cups/raster.h>
-#include <cups/string-private.h>
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -54,6 +52,14 @@ main(int  argc,                              /* I - Number of command-line args */
                        linesize,       /* Bytes per line */
                        lineoffset;     /* Offset into line */
   unsigned char                white;          /* White pixel */
+  ppd_file_t           *ppd;           /* PPD file */
+  ppd_attr_t           *back;          /* cupsBackSize attribute */
+  _ppd_cache_t         *cache;         /* PPD cache */
+  _pwg_size_t          *pwg_size;      /* PWG media size */
+  _pwg_media_t         *pwg_media;     /* PWG media name */
+  int                  num_options;    /* Number of options */
+  cups_option_t                *options = NULL;/* Options */
+  const char           *val;           /* Option value */
 
 
   if (argc < 6 || argc > 7)
@@ -75,6 +81,16 @@ main(int  argc,                              /* I - Number of command-line args */
   inras  = cupsRasterOpen(fd, CUPS_RASTER_READ);
   outras = cupsRasterOpen(1, CUPS_RASTER_WRITE_PWG);
 
+  ppd   = ppdOpenFile(getenv("PPD"));
+  back  = ppdFindAttr(ppd, "cupsBackSide", NULL);
+
+  num_options = cupsParseOptions(argv[5], 0, &options);
+
+  ppdMarkDefaults(ppd);
+  cupsMarkOptions(ppd, num_options, options);
+
+  cache = ppd ? ppd->cache : NULL;
+
   while (cupsRasterReadHeader2(inras, &inheader))
   {
    /*
@@ -126,6 +142,7 @@ main(int  argc,                             /* I - Number of command-line args */
       case CUPS_CSPACE_DEVICEF :
           white = 0;
          break;
+
       default :
          _cupsLangPrintFilter(stderr, "ERROR", _("Unsupported raster data."));
          fprintf(stderr, "DEBUG: Unsupported cupsColorSpace %d on page %d.\n",
@@ -151,10 +168,236 @@ main(int  argc,                          /* I - Number of command-line args */
     }
 
     memcpy(&outheader, &inheader, sizeof(outheader));
-    outheader.cupsWidth  = page_width;
+    outheader.cupsWidth        = page_width;
     outheader.cupsHeight       = page_height;
     outheader.cupsBytesPerLine = linesize;
 
+    outheader.cupsInteger[14]  = 0;    /* VendorIdentifier */
+    outheader.cupsInteger[15]  = 0;    /* VendorLength */
+
+    if ((val = cupsGetOption("print-content-optimize", num_options,
+                             options)) != NULL)
+    {
+      if (!strcmp(val, "automatic"))
+        strlcpy(outheader.OutputType, "Automatic",
+                sizeof(outheader.OutputType));
+      else if (!strcmp(val, "graphics"))
+        strlcpy(outheader.OutputType, "Graphics", sizeof(outheader.OutputType));
+      else if (!strcmp(val, "photo"))
+        strlcpy(outheader.OutputType, "Photo", sizeof(outheader.OutputType));
+      else if (!strcmp(val, "text"))
+        strlcpy(outheader.OutputType, "Text", sizeof(outheader.OutputType));
+      else if (!strcmp(val, "text-and-graphics"))
+        strlcpy(outheader.OutputType, "TextAndGraphics",
+                sizeof(outheader.OutputType));
+      else
+      {
+        fprintf(stderr, "DEBUG: Unsupported print-content-type \"%s\".\n", val);
+        outheader.OutputType[0] = '\0';
+      }
+    }
+
+    if ((val = cupsGetOption("print-quality", num_options, options)) != NULL)
+    {
+      int quality = atoi(val);         /* print-quality value */
+
+      if (quality >= IPP_QUALITY_DRAFT && quality <= IPP_QUALITY_HIGH)
+       outheader.cupsInteger[8] = quality;
+      else
+      {
+       fprintf(stderr, "DEBUG: Unsupported print-quality %d.\n", quality);
+       outheader.cupsInteger[8] = 0;
+      }
+    }
+
+    if ((val = cupsGetOption("print-rendering-intent", num_options,
+                             options)) != NULL)
+    {
+      if (!strcmp(val, "absolute"))
+        strlcpy(outheader.cupsRenderingIntent, "Absolute",
+                sizeof(outheader.cupsRenderingIntent));
+      else if (!strcmp(val, "automatic"))
+        strlcpy(outheader.cupsRenderingIntent, "Automatic",
+                sizeof(outheader.cupsRenderingIntent));
+      else if (!strcmp(val, "perceptual"))
+        strlcpy(outheader.cupsRenderingIntent, "Perceptual",
+                sizeof(outheader.cupsRenderingIntent));
+      else if (!strcmp(val, "relative"))
+        strlcpy(outheader.cupsRenderingIntent, "Relative",
+                sizeof(outheader.cupsRenderingIntent));
+      else if (!strcmp(val, "relative-bpc"))
+        strlcpy(outheader.cupsRenderingIntent, "RelativeBpc",
+                sizeof(outheader.cupsRenderingIntent));
+      else if (!strcmp(val, "saturation"))
+        strlcpy(outheader.cupsRenderingIntent, "Saturation",
+                sizeof(outheader.cupsRenderingIntent));
+      else
+      {
+        fprintf(stderr, "DEBUG: Unsupported print-rendering-intent \"%s\".\n",
+                val);
+        outheader.cupsRenderingIntent[0] = '\0';
+      }
+    }
+
+    if (inheader.cupsPageSizeName[0] &&
+        (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL)
+    {
+      strlcpy(outheader.cupsPageSizeName, pwg_size->map.pwg,
+             sizeof(outheader.cupsPageSizeName));
+    }
+    else
+    {
+      pwg_media = _pwgMediaForSize((int)(2540.0 * inheader.cupsPageSize[0] /
+                                         72.0),
+                                   (int)(2540.0 * inheader.cupsPageSize[1] /
+                                         72.0));
+
+      if (pwg_media)
+        strlcpy(outheader.cupsPageSizeName, pwg_media->pwg,
+                sizeof(outheader.cupsPageSizeName));
+      else
+      {
+        fprintf(stderr, "DEBUG: Unsupported PageSize %.2fx%.2f.\n",
+                inheader.cupsPageSize[0], inheader.cupsPageSize[1]);
+        outheader.cupsPageSizeName[0] = '\0';
+      }
+    }
+
+    if (inheader.Duplex && !(page & 1) &&
+        back && _cups_strcasecmp(back->value, "Normal"))
+    {
+      if (_cups_strcasecmp(back->value, "Flipped"))
+      {
+        if (inheader.Tumble)
+        {
+         outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
+         outheader.cupsInteger[2] = 1; /* FeedTransform */
+
+         outheader.cupsInteger[3] = page_width - page_left -
+                                    inheader.cupsWidth;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_top;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_width - page_left;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_bottom;
+                                       /* ImageBoxBottom */
+        }
+        else
+        {
+         outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
+         outheader.cupsInteger[2] = -1;/* FeedTransform */
+
+         outheader.cupsInteger[3] = page_left;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_bottom;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_left + inheader.cupsWidth;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_top;
+                                       /* ImageBoxBottom */
+        }
+      }
+      else if (_cups_strcasecmp(back->value, "ManualTumble"))
+      {
+        if (inheader.Tumble)
+        {
+         outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
+         outheader.cupsInteger[2] = -1;/* FeedTransform */
+
+         outheader.cupsInteger[3] = page_width - page_left -
+                                    inheader.cupsWidth;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_bottom;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_width - page_left;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_top;
+                                       /* ImageBoxBottom */
+        }
+        else
+        {
+         outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
+         outheader.cupsInteger[2] = 1; /* FeedTransform */
+
+         outheader.cupsInteger[3] = page_left;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_top;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_left + inheader.cupsWidth;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_bottom;
+                                       /* ImageBoxBottom */
+        }
+      }
+      else if (_cups_strcasecmp(back->value, "Rotated"))
+      {
+        if (inheader.Tumble)
+        {
+         outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
+         outheader.cupsInteger[2] = -1;/* FeedTransform */
+
+         outheader.cupsInteger[3] = page_width - page_left -
+                                    inheader.cupsWidth;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_bottom;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_width - page_left;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_top;
+                                       /* ImageBoxBottom */
+        }
+        else
+        {
+         outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
+         outheader.cupsInteger[2] = 1; /* FeedTransform */
+
+         outheader.cupsInteger[3] = page_left;
+                                       /* ImageBoxLeft */
+         outheader.cupsInteger[4] = page_top;
+                                       /* ImageBoxTop */
+         outheader.cupsInteger[5] = page_left + inheader.cupsWidth;
+                                       /* ImageBoxRight */
+         outheader.cupsInteger[6] = page_height - page_bottom;
+                                       /* ImageBoxBottom */
+        }
+      }
+      else
+      {
+       /*
+        * Unsupported value...
+        */
+
+        fprintf(stderr, "DEBUG: Unsupported cupsBackSide \"%s\".\n", back->value);
+
+       outheader.cupsInteger[1] = 1;   /* CrossFeedTransform */
+       outheader.cupsInteger[2] = 1;   /* FeedTransform */
+
+       outheader.cupsInteger[3] = page_left;
+                                       /* ImageBoxLeft */
+       outheader.cupsInteger[4] = page_top;
+                                       /* ImageBoxTop */
+       outheader.cupsInteger[5] = page_left + inheader.cupsWidth;
+                                       /* ImageBoxRight */
+       outheader.cupsInteger[6] = page_height - page_bottom;
+                                       /* ImageBoxBottom */
+      }
+    }
+    else
+    {
+      outheader.cupsInteger[1] = 1;    /* CrossFeedTransform */
+      outheader.cupsInteger[2] = 1;    /* FeedTransform */
+
+      outheader.cupsInteger[3] = page_left;
+                                       /* ImageBoxLeft */
+      outheader.cupsInteger[4] = page_top;
+                                       /* ImageBoxTop */
+      outheader.cupsInteger[5] = page_left + inheader.cupsWidth;
+                                       /* ImageBoxRight */
+      outheader.cupsInteger[6] = page_height - page_bottom;
+                                       /* ImageBoxBottom */
+    }
+
     if (!cupsRasterWriteHeader2(outras, &outheader))
     {
       _cupsLangPrintFilter(stderr, "ERROR", _("Error sending raster data."));