- Applied fix for rotated PDFs (bug #236753, STR #2348).

This commit is contained in:
Tim Waugh 2007-05-09 13:12:09 +00:00
parent 41fae3e439
commit 3b32489cae
2 changed files with 56 additions and 1 deletions

50
cups-str2348.patch Normal file
View File

@ -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");

View File

@ -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 <twaugh@redhat.com> 1:1.2.10-9
- Applied fix for rotated PDFs (bug #236753, STR #2348).
* Thu Apr 26 2007 Tim Waugh <twaugh@redhat.com> 1:1.2.10-8
- Initscript fixes (bug #237955).