]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix cupsRotation comment to correspond to the actual required
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 8 May 2007 16:28:32 +0000 (16:28 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 8 May 2007 16:28:32 +0000 (16:28 +0000)
rotation for the labels (STR #2348)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@6523 7a7537e8-13f0-0310-91df-b6672ffda945

pdftops/PSOutputDev.cxx

index 18b893c37d256a153279df3c0273241775a2ed12..6c8abf095a645bb5d83286787e8b16cd31d699e6 100644 (file)
@@ -1159,7 +1159,14 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage,
   }
 
   // Tell CUPS pstops filter not to do its own rotation...
-  writePSFmt("%%cupsRotation: %d\n", pageRotate);
+  int cups_rotate = 0;
+  int width = (int)ceil(mediaBox->x2 - mediaBox->x1);
+  int height = (int)ceil(mediaBox->y2 - mediaBox->y1);
+  int imgWidth = (int)ceil(cropBox->x2 - cropBox->x1);
+
+  if (width > height && width > imgWidth) cups_rotate = 90;
+
+  writePSFmt("%%cupsRotation: %d\n", cups_rotate);
 
   writePSFmt("%%Producer: xpdf/pdftops %s\n", xpdfVersion);
   xref->getDocInfo(&info);
@@ -2515,7 +2522,6 @@ GBool PSOutputDev::startPage(int pageNum, GfxState *state) {
       fprintf(stderr, "DEBUG: Page rotate=%d, width=%d, height=%d, imgWidth=%d, imgHeight=%d\n",
               state->getRotate(), width, height, imgWidth, imgHeight);
 
-      rotate = (360 - state->getRotate()) % 360;
       if (rotate == 0 || rotate == 180) {
        if (width > height && width > imgWidth) {
          rotate += 90;