The "landscape" option rotates the input pages by 90 degrees, in the
direction given by the "*LandscapeOrientation" in the PPD file.
The "orientation-requested" option/IPP attribute rotates the page
according to its value: 3: No rotation; 4: 90 degrees anticlockwise;
5: 90 dgrees clockwise; 6: 180 degrees (upside-down).
After that, at least when not suppressed via "nopdfAutoRotate"
("pdfAutoRotate=false") option, auto-rotation kicks in, rotating the
page by 90 degrees (direction according to "*LandscapeOrientation" in
the PPD file) if the orientations of the input page and the output
page mis-match.
See also:
https://openprinting.github.io/cups/doc/options.html
https://wiki.debian.org/CUPSPdfToPdf
When applying the "landscape" or "orientation-requested" option the
following bugs occured:
1. The page image did not only get rotated but also de-centered. See
issue #456.
2. When cropping ("print-scaling=none" or "print-scaling=fill")
portrait-oriented pages got wrongly cropped.
3. When using N-up ("number-up" option) division of the output page
into cells happened in the wrong oriantation.
This commit fixes these issues.
(manually backported from commit
9b86754edb4362c0765469eac1c315904cc295d9)
CHANGES IN V1.28.14
+ - pdftopdf: Correct the output when the
+ "orientation-requested" or the "landscape" option is
+ supplied. Output could be de-centered (Issue #456),
+ portrait-oriented pages be wrongly cropped and division of
+ the output page into cells for N-up done in the wrong
+ orientation.
- rastertopdf: In PCLm output mode the filter failed to
generate PCLm if the printer has no
"pclm-source-resolution-default" IPP attribute.
const bool dst_lscape =
(param.paper_is_landscape ==
((param.orientation == ROT_0) || (param.orientation == ROT_180)));
- if (dst_lscape)
+
+ if (param.paper_is_landscape)
std::swap(param.nup.nupX, param.nup.nupY);
if (param.autoRotate)
for(int i=0;i<(int)pages.size();i++)
{
std::shared_ptr<PDFTOPDF_PageHandle> page = pages[i];
- Rotation orientation = param.orientation;
- if (param.noOrientation &&
- page->is_landscape(param.orientation))
+ Rotation orientation;
+ if (page->is_landscape(param.orientation))
orientation = param.normal_landscape;
+ else
+ orientation = ROT_0;
page->crop(param.page, orientation, param.xpos, param.ypos,
!param.cropfit);
}
if ((param.nup.nupX == 1) && (param.nup.nupY == 1))
{
double xpos2, ypos2;
- if (param.orientation == ROT_270 || param.orientation == ROT_90)
+ if ((param.page.height - param.page.width) *
+ (page->getRect().height - page->getRect().width) < 0)
{
xpos2 = (param.page.width - (page->getRect().height)) / 2;
ypos2 = (param.page.height - (page->getRect().width)) / 2;