Remove duplex from IPP attributes if PS
This commit is contained in:
parent
8b3ffad513
commit
3bf59f0141
4 changed files with 17 additions and 8 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()));
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue