]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 25 Jul 2003 20:26:21 +0000 (20:26 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 25 Jul 2003 20:26:21 +0000 (20:26 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3833 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
pdftops/pdftops.cxx

index 4e4f37e56261787fccc04d3bcf46e29043e2c488..e15e842fd2327a9a7465bb5afe58026915c7fed8 100644 (file)
@@ -3,6 +3,9 @@ CHANGES-1.1.txt
 
 CHANGES IN CUPS V1.1.20rc1
 
+       - The pdftops filter incorrectly auto-rotated pages when
+         the user already had specified the proper orientation
+         (STR #207)
        - Fixed AIX shared library support (STR #201)
        - Added support for live testing with Valgrind (STR
          #193)
index 422295aa1e32d64c73e73bf0eccf9e11017b4d32..b09a9d020ff029b51f25a440646f0c6ef98a4285 100644 (file)
@@ -1,10 +1,35 @@
-//========================================================================
 //
-// pdftops.cc
+// "$Id: pdftops.cxx,v 1.6.2.6 2003/07/25 20:26:21 mike Exp $"
 //
-// Copyright 1996 Derek B. Noonburg
+//   PDF to PostScript filter front-end for the Common UNIX Printing
+//   System (CUPS).
+//
+//   Copyright 1997-2003 by Easy Software Products.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Easy Software Products and are protected by Federal
+//   copyright law.  Distribution and use rights are outlined in the file
+//   "LICENSE.txt" which should have been included with this file.  If this
+//   file is missing or damaged please contact Easy Software Products
+//   at:
+//
+//       Attn: CUPS Licensing Information
+//       Easy Software Products
+//       44141 Airport View Drive, Suite 204
+//       Hollywood, Maryland 20636-3111 USA
+//
+//       Voice: (301) 373-9600
+//       EMail: cups-info@cups.org
+//         WWW: http://www.cups.org
+//
+// Contents:
+//
+//   main() - Main entry for filter...
+//
+
+//
+// Include necessary headers...
 //
-//========================================================================
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <cups/cups.h>
 
-int main(int argc, char *argv[]) {
+
+//
+// 'main()' - Main entry for filter...
+//
+
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line args
+     char *argv[])                     // I - Command-line arguments
+{
   PDFDoc       *doc;
   GString      *fileName;
   GString      *psFileName;
@@ -46,6 +79,8 @@ int main(int argc, char *argv[]) {
   int          bytes;
   int          width, length;
   int          left, bottom, right, top;
+  int          orientation;
+  int          temp;
   int          duplex;
 
 
@@ -111,6 +146,84 @@ int main(int argc, char *argv[]) {
     level = ppd->language_level == 1 ? psLevel1 : psLevel2;
   }
 
+  // Track the orientation of the print job and update the page
+  // dimensions and margins as needed...
+  orientation = 0;
+
+  if ((val = cupsGetOption("landscape", num_options, options)) != NULL)
+  {
+    if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 &&
+        strcasecmp(val, "false") != 0)
+      orientation = 1;
+  }
+  else if ((val = cupsGetOption("orientation-requested", num_options, options)) != NULL)
+  {
+   /*
+    * Map IPP orientation values to 0 to 3:
+    *
+    *   3 = 0 degrees   = 0
+    *   4 = 90 degrees  = 1
+    *   5 = -90 degrees = 3
+    *   6 = 180 degrees = 2
+    */
+
+    orientation = atoi(val) - 3;
+    if (orientation >= 2)
+      orientation ^= 1;
+  }
+
+  switch (orientation & 3)
+  {
+    case 0 : /* Portait */
+        break;
+
+    case 1 : /* Landscape */
+       temp   = left;
+       left   = bottom;
+       bottom = temp;
+
+       temp   = right;
+       right  = top;
+       top    = temp;
+
+       temp   = width;
+       width  = length;
+       length = temp;
+       break;
+
+    case 2 : /* Reverse Portrait */
+       temp   = width - left;
+       left   = width - right;
+       right  = temp;
+
+       temp   = length - bottom;
+       bottom = length - top;
+       top    = temp;
+        break;
+
+    case 3 : /* Reverse Landscape */
+       temp   = width - left;
+       left   = width - right;
+       right  = temp;
+
+       temp   = length - bottom;
+       bottom = length - top;
+       top    = temp;
+
+       temp   = left;
+       left   = bottom;
+       bottom = temp;
+
+       temp   = right;
+       right  = top;
+       top    = temp;
+
+       temp   = width;
+       width  = length;
+       length = temp;
+       break;
+  }
+
   if ((val = cupsGetOption("sides", num_options, options)) != NULL &&
       strncasecmp(val, "two-", 4) == 0)
     duplex = 1;
@@ -202,3 +315,8 @@ int main(int argc, char *argv[]) {
 
   return 0;
 }
+
+
+//
+// End of "$Id: pdftops.cxx,v 1.6.2.6 2003/07/25 20:26:21 mike Exp $".
+//