[cups.bugs] [MOD] STR #2348: PDF rotation issue
twaugh.redhat
twaugh at redhat.com
Wed Apr 18 06:05:32 PDT 2007
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
For the strollingmap.pdf case, here is a diff between the actual result
after pdftops and pstops filters, and a correct-looking result:
--- strollingmap-ps.ps 2007-04-18 11:08:49.000000000 +0100
+++ strollingmap-working-ps.ps 2007-04-18 11:32:03.000000000 +0100
@@ -705,7 +705,7 @@
%%PageOrientation: Landscape
pdfStartPage
180 rotate
--718.5 -719 translate
+-842 -586.304 translate
0 0 842 596 re W
%%EndPageSetup
[] 0 d
The problem in this case seems to be two-fold:
a) tx and ty need to be swapped
b) the code for placing the image in the center of the paper is not
comparing like with like.
I managed to get correct output by applying this wrong-looking patch:
--- cups-1.2.10/pdftops/PSOutputDev.cxx.pdftops-landscape 2007-02-05
20:25:50.000000000 +0000
+++ cups-1.2.10/pdftops/PSOutputDev.cxx 2007-04-18 12:13:48.000000000
+0100
@@ -2552,6 +2552,12 @@
imgWidth2 = imgHeight;
imgHeight2 = imgWidth;
}
+ // landscape
+ if (landscape) {
+ double tmpt = tx;
+ tx = ty;
+ ty = tmpt;
+ }
// shrink or expand
if (xScale0 > 0 && yScale0 > 0) {
xScale = xScale0;
@@ -2587,8 +2593,8 @@
tx += (imgWidth2 - xScale * (clipURX0 - clipLLX0)) / 2;
ty += (imgHeight2 - yScale * (clipURY0 - clipLLY0)) / 2;
} else {
- tx += (imgWidth2 - xScale * width) / 2;
- ty += (imgHeight2 - yScale * height) / 2;
+ tx += (imgWidth2 - xScale * (landscape ? height : width)) / 2;
+ ty += (imgHeight2 - yScale * (landscape ? width : height)) / 2;
}
}
tx += rotate == 0 ? imgLLX + tx0 : imgLLY + ty0;
...however, the dayplanner.pdf case seems to be more complicated even than
that. The actual vs expected diff for dayplanner.pdf is:
--- dayplanner-ps.ps 2007-04-18 13:07:12.000000000 +0100
+++ dayplanner-working-ps.ps 2007-04-18 13:06:58.000000000 +0100
@@ -1548,7 +1548,7 @@
%%PageOrientation: Portrait
pdfStartPage
90 rotate
-123.5 -718.5 translate
+0 -842 translate
0 0 595 842 re W
%%EndPageSetup
[] 0 d
(for each page)
The '123.5' comes from the bad re-centre code: it's (842-595)/2, i.e. half
A4 height minus A4 width. However, the PSOutputDev.cxx patch above did
not fix the processing of dayplanner.pdf, so I'm a bit stumped.
strollingmap.pdf: landscape=true, rotate=180
dayplanner.pdf: landscape=false, rotate=90
Link: http://www.cups.org/str.php?L2348
Version: 1.2.10
More information about the cups-devel
mailing list