summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-10-29 12:10:13 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-10-29 13:34:32 +0100
commit152896274aca291a5d2181db6dd639c3e36c2a02 (patch)
treebe70f19dabf5708c6bd0363b4caccf6501d1152a
parent53bedc8bc19f90cfad9bdc921c9ecc90f4980104 (diff)
tdf#161152 vcl: Set CUPS "sides" option for duplex mode
When the PPD "Duplex" option is set in a print job, also set the CUPS "sides" option documented at [1], section "Printing On Both Sides of the Paper". This is apparently required for at least some Brother printers where the "Duplex" PPD option is not evaluated during the print process. [1] https://www.cups.org/doc/options.html Change-Id: Ib280c3c65eaf7bf74b611f0ce921eda51b1ebe19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175782 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 8fc18bb5fa1e..fa61a6052b20 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -649,6 +649,18 @@ void CUPSManager::getOptionsFromDocumentSetup(const JobData& rJob, bool bBanner,
OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US );
OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US );
rNumOptions = cupsAddOption(aKey.getStr(), aValue.getStr(), rNumOptions, ppOptions);
+
+ // for duplex, also set the corresponding CUPS "sides" option, see section
+ // "Printing On Both Sides of the Paper" at https://www.cups.org/doc/options.html
+ if (aKey == "Duplex")
+ {
+ if (aValue == "None")
+ rNumOptions = cupsAddOption("sides", "one-sided", rNumOptions, ppOptions);
+ else if (aValue == "DuplexTumble")
+ rNumOptions = cupsAddOption("sides", "two-sided-short-edge", rNumOptions, ppOptions);
+ else if (aValue == "DuplexNoTumble")
+ rNumOptions = cupsAddOption("sides", "two-sided-long-edge", rNumOptions, ppOptions);
+ }
}
}
}