From 3b32489caefb8c1ddef908698050d3eb52fac949 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: May 09 2007 13:12:09 +0000 Subject: - Applied fix for rotated PDFs (bug #236753, STR #2348). --- diff --git a/cups-str2348.patch b/cups-str2348.patch new file mode 100644 index 0000000..2b0f0f8 --- /dev/null +++ b/cups-str2348.patch @@ -0,0 +1,50 @@ +--- cups-1.2.10/pdftops/PSOutputDev.cxx.str2348 2007-02-05 20:25:50.000000000 +0000 ++++ cups-1.2.10/pdftops/PSOutputDev.cxx 2007-05-09 13:20:13.000000000 +0100 +@@ -1159,7 +1159,14 @@ + } + + // 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); +@@ -2511,17 +2518,19 @@ + landscape = gFalse; + } else { + rotate = (360 - state->getRotate()) % 360; ++ ++ fprintf(stderr, "DEBUG: Page rotate=%d, width=%d, height=%d, imgWidth=%d, imgHeight=%d\n", ++ state->getRotate(), width, height, imgWidth, imgHeight); ++ + if (rotate == 0 || rotate == 180) { +- if ((width > height && imgWidth < imgHeight) || +- (height > width && imgHeight < imgWidth)) { ++ if (width > height && width > imgWidth) { + rotate += 90; + landscape = gTrue; + } else { + landscape = gFalse; + } + } else { // rotate == 90 || rotate == 270 +- if ((width > height && imgWidth < imgHeight) || +- (height > width && imgHeight < imgWidth)) { ++ if (height > width && height > imgWidth) { + rotate = 270 - rotate; + landscape = gTrue; + } else { +@@ -2529,6 +2538,7 @@ + } + } + } ++ + writePSFmt("%%%%PageOrientation: %s\n", + landscape ? "Landscape" : "Portrait"); + writePS("pdfStartPage\n"); diff --git a/cups.spec b/cups.spec index 8a1b857..cfe2930 100644 --- a/cups.spec +++ b/cups.spec @@ -6,7 +6,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.2.10 -Release: 8%{?dist} +Release: 9%{?dist} License: GPL Group: System Environment/Daemons Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -47,6 +47,7 @@ Patch22: cups-af_unix-auth.patch Patch23: cups-str2323.patch Patch24: cups-str2109.patch Patch25: cups-usb-paperout.patch +Patch26: cups-str2348.patch Patch100: cups-lspp.patch Epoch: 1 Url: http://www.cups.org/ @@ -156,6 +157,7 @@ lpd emulation. %patch23 -p1 -b .str2323 %patch24 -p1 -b .str2109 %patch25 -p1 -b .usb-paperout +%patch26 -p1 -b .str2348 %if %lspp %patch100 -p1 -b .lspp @@ -442,6 +444,9 @@ rm -rf $RPM_BUILD_ROOT %{cups_serverbin}/daemon/cups-lpd %changelog +* Wed May 9 2007 Tim Waugh 1:1.2.10-9 +- Applied fix for rotated PDFs (bug #236753, STR #2348). + * Thu Apr 26 2007 Tim Waugh 1:1.2.10-8 - Initscript fixes (bug #237955).