From 187d2ae44f030462a2ba884eca2d19ab57cd792f Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 8 May 2007 16:28:32 +0000 Subject: [PATCH] Fix cupsRotation comment to correspond to the actual required 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pdftops/PSOutputDev.cxx b/pdftops/PSOutputDev.cxx index 18b893c37d..6c8abf095a 100644 --- a/pdftops/PSOutputDev.cxx +++ b/pdftops/PSOutputDev.cxx @@ -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; -- 2.47.2