Remove duplex from IPP attributes if PS

This commit is contained in:
Anton Thomasson 2020-06-07 15:27:27 +02:00
parent 8b3ffad513
commit 3bf59f0141
4 changed files with 17 additions and 8 deletions

View file

@ -99,8 +99,8 @@ ApplicationWindow
ConfigurationValue
{
id: removeRedundantAttributesForRasterSetting
key: "/apps/harbour-seaprint/settings/remove-redundant-raster-attributes"
id: removeRedundantConvertAttrsSetting
key: "/apps/harbour-seaprint/settings/remove-redundant-convert-attributes"
defaultValue: true
}

View file

@ -29,7 +29,7 @@ Page {
printer.print(jobParams, page.selectedFile,
alwaysConvertSetting.value,
forceIncluDeDocumentFormatSetting.value,
removeRedundantAttributesForRasterSetting.value)
removeRedundantConvertAttrsSetting.value)
}
}
}

View file

@ -126,8 +126,12 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
{
QProcess* pdftops = new QProcess(this);
pdftops->setProgram("pdftops");
// -duplex?
pdftops->setArguments({"-paper", ShortPaperSize, filename, "-"});
QStringList PdfToPsArgs = {"-paper", ShortPaperSize, filename, "-"};
if(TwoSided)
{
PdfToPsArgs.prepend("-duplex");
}
pdftops->setArguments(PdfToPsArgs);
pdftops->setStandardOutputFile(tempfile->fileName(), QIODevice::Append);
connect(pdftops, SIGNAL(finished(int, QProcess::ExitStatus)), pdftops, SLOT(deleteLater()));

View file

@ -298,10 +298,10 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray
}
void IppPrinter::print(QJsonObject attrs, QString filename,
bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantAttributesForRaster)
bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantConvertAttrs)
{
qDebug() << "printing" << filename << attrs
<< alwaysConvert << forceIncluDeDocumentFormat << removeRedundantAttributesForRaster;
<< alwaysConvert << forceIncluDeDocumentFormat << removeRedundantConvertAttrs;
_progress = "";
emit progressChanged();
@ -392,11 +392,16 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
}
QString Sides = getAttrOrDefault(attrs, "sides").toString();
if(removeRedundantAttributesForRaster && (documentFormat=="image/pwg-raster" || documentFormat=="image/urf"))
if(removeRedundantConvertAttrs && (documentFormat=="image/pwg-raster" ||
documentFormat=="image/urf"))
{
attrs.remove("sides");
attrs.remove("print-color-mode");
}
if(removeRedundantConvertAttrs && documentFormat == "application/postscript")
{
attrs.remove("sides");
}
qDebug() << "Final job attributes:" << attrs;