You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Landscape PDF prints incorrectly with orientation-requested=4 #2850
I have an A4 landscape PDF creating using OpenOffice.org 2.3.0. When I try printing this to a Fedora 9 CUPS queue, the output is incorrect: it looks like the page has been rotated again, making it portrait but cropping the right-hand side of the original landscape page.
I printed it like this:
lp -oorientation-requested=4 landscape.pdf
Representation of original PDF:
+------+
|ABCDEF|
|ABCDEF|
+------+
Representation of printed page:
+---+
|ABC|
|ABC|
| |
+---+
(in fact the output looks stretched horizontally as well)
Printing the same document without 'orientation-requested=4' gives the correct (expected) output.
The fix is basically to not use the imageable area from the PPD file, and to no longer use the cupsRotation comment in the PostScript output. This yields essentially the same output as the CUPS 1.4 pdftops wrapper...
--- pdftops/pdftops.cxx (revision 7725)
+++ pdftops/pdftops.cxx (working copy)
@@ -4,7 +4,7 @@
// PDF to PostScript filter front-end for the Common UNIX Printing
// System (CUPS).
//
-// Copyright 2007 by Apple Inc.
+// Copyright 2007-2008 by Apple Inc.
// Copyright 1997-2006 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
@@ -70,8 +70,6 @@
char buffer[8192]; // Copy buffer
int bytes; // Bytes copied
int width, length; // Size in points
int left, bottom, right, top;
// Imageable area in points
int orientation; // Orientation
int temp; // Temporary var
int duplex; // Duplex the output?
@@ -110,10 +108,6 @@
}
// Default to "Universal" size - min of A4 and Letter...
case 1 : /* Landscape /
case 3 : / Reverse Landscape */
temp = width - left;
left = width - right;
- right = temp;
temp = length - bottom;
bottom = length - top;
- top = temp;
temp = left;
left = bottom;
- bottom = temp;
temp = right;
right = top;
- top = temp;
temp = width;
width = length;
length = temp;
@@ -277,9 +229,13 @@
// Only set paper size and area if we are fitting to the job's
// page size or the pdftops.conf file does not contain
// "psPaperSize match"...
+
fprintf(stderr, "DEBUG: Setting paper dimensions to %dx%d!\n", width,
Activity
michaelrsweet commentedon Jun 6, 2008
CUPS.org User: mike
Which pdftops filter are you using in FC9?
michaelrsweet commentedon Jun 6, 2008
CUPS.org User: twaugh.redhat
It's the one that comes with CUPS 1.3.7. We don't replace it. (Perhaps you're confusing it with texttopaps, which we use to replace texttops..)
michaelrsweet commentedon Jul 14, 2008
CUPS.org User: mike
Fixed in Subversion repository.
The fix is basically to not use the imageable area from the PPD file, and to no longer use the cupsRotation comment in the PostScript output. This yields essentially the same output as the CUPS 1.4 pdftops wrapper...
michaelrsweet commentedon Jul 14, 2008
"str2850.patch":
Index: pdftops/PSOutputDev.cxx
--- pdftops/PSOutputDev.cxx (revision 7725)
+++ pdftops/PSOutputDev.cxx (working copy)
@@ -1166,8 +1166,6 @@
if (width > height && width > imgWidth) cups_rotate = 90;
- writePSFmt("%%cupsRotation: %d\n", cups_rotate);
writePSFmt("%%Producer: xpdf/pdftops %s\n", xpdfVersion);
xref->getDocInfo(&info);
if (info.isDict() && info.dictLookup("Creator", &obj1)->isString()) {
@@ -2519,8 +2517,9 @@
} else {
rotate = (360 - state->getRotate()) % 360;
if (rotate == 0 || rotate == 180) {
if (width > height && width > imgWidth) {
@@ -2539,6 +2538,9 @@
}
}
fprintf(stderr, "DEBUG: Using rotate=%d, width=%d, height=%d, imgWidth=%d, imgHeight=%d\n",
writePSFmt("%%%%PageOrientation: %s\n",
landscape ? "Landscape" : "Portrait");
writePS("pdfStartPage\n");
Index: pdftops/pdftops.cxx
--- pdftops/pdftops.cxx (revision 7725)
+++ pdftops/pdftops.cxx (working copy)
@@ -4,7 +4,7 @@
// PDF to PostScript filter front-end for the Common UNIX Printing
// System (CUPS).
//
-// Copyright 2007 by Apple Inc.
+// Copyright 2007-2008 by Apple Inc.
// Copyright 1997-2006 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
@@ -70,8 +70,6 @@
char buffer[8192]; // Copy buffer
int bytes; // Bytes copied
int width, length; // Size in points
int left, bottom, right, top;
int orientation; // Orientation
int temp; // Temporary var
int duplex; // Duplex the output?
@@ -110,10 +108,6 @@
}
// Default to "Universal" size - min of A4 and Letter...
left = 0;
bottom = 0;
right = 595;
top = 792;
width = 595;
length = 792;
level = psLevel2;
@@ -132,10 +126,6 @@
if ((size = ppdPageSize(ppd, NULL)) != NULL)
{
width = (int)size->width;
length = (int)size->length;
}
@@ -172,49 +162,11 @@
switch (orientation & 3)
{
case 0 : /* Portait */
- break;
- bottom = temp;
- top = temp;
- break;
- right = temp;
break;
case 3 : / Reverse Landscape */
- right = temp;
- top = temp;
- bottom = temp;
- top = temp;
@@ -277,9 +229,13 @@
// Only set paper size and area if we are fitting to the job's
// page size or the pdftops.conf file does not contain
// "psPaperSize match"...
+
globalParams->setPSPaperWidth(width);globalParams->setPSPaperHeight(length);
}
globalParams->setPSDuplex(duplex);