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 ConfigurationValue
{ {
id: removeRedundantAttributesForRasterSetting id: removeRedundantConvertAttrsSetting
key: "/apps/harbour-seaprint/settings/remove-redundant-raster-attributes" key: "/apps/harbour-seaprint/settings/remove-redundant-convert-attributes"
defaultValue: true defaultValue: true
} }

View file

@ -29,7 +29,7 @@ Page {
printer.print(jobParams, page.selectedFile, printer.print(jobParams, page.selectedFile,
alwaysConvertSetting.value, alwaysConvertSetting.value,
forceIncluDeDocumentFormatSetting.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); QProcess* pdftops = new QProcess(this);
pdftops->setProgram("pdftops"); pdftops->setProgram("pdftops");
// -duplex? QStringList PdfToPsArgs = {"-paper", ShortPaperSize, filename, "-"};
pdftops->setArguments({"-paper", ShortPaperSize, filename, "-"}); if(TwoSided)
{
PdfToPsArgs.prepend("-duplex");
}
pdftops->setArguments(PdfToPsArgs);
pdftops->setStandardOutputFile(tempfile->fileName(), QIODevice::Append); pdftops->setStandardOutputFile(tempfile->fileName(), QIODevice::Append);
connect(pdftops, SIGNAL(finished(int, QProcess::ExitStatus)), pdftops, SLOT(deleteLater())); 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, void IppPrinter::print(QJsonObject attrs, QString filename,
bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantAttributesForRaster) bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantConvertAttrs)
{ {
qDebug() << "printing" << filename << attrs qDebug() << "printing" << filename << attrs
<< alwaysConvert << forceIncluDeDocumentFormat << removeRedundantAttributesForRaster; << alwaysConvert << forceIncluDeDocumentFormat << removeRedundantConvertAttrs;
_progress = ""; _progress = "";
emit progressChanged(); emit progressChanged();
@ -392,11 +392,16 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
} }
QString Sides = getAttrOrDefault(attrs, "sides").toString(); 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("sides");
attrs.remove("print-color-mode"); attrs.remove("print-color-mode");
} }
if(removeRedundantConvertAttrs && documentFormat == "application/postscript")
{
attrs.remove("sides");
}
qDebug() << "Final job attributes:" << attrs; qDebug() << "Final job attributes:" << attrs;