diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml
index 8fe0294..9740c53 100644
--- a/qml/pages/PrinterPage.qml
+++ b/qml/pages/PrinterPage.qml
@@ -28,7 +28,6 @@ Page {
PageStackAction.Immediate)
printer.print(jobParams, page.selectedFile,
alwaysConvertSetting.value,
- forceIncluDeDocumentFormatSetting.value,
removeRedundantConvertAttrsSetting.value)
}
}
@@ -118,7 +117,7 @@ Page {
prettyName: prettyName,
tag: tag,
valid: printer.attrs.hasOwnProperty(name+"-supported"),
- choices: maybeSupplementChoices(name, printer.attrs[name+"-supported"].value),
+ choices: printer.attrs[name+"-supported"].value,
default_choice: printer.attrs[name+"-default"].value,
mime_type: Mimer.get_type(selectedFile)
})
@@ -126,15 +125,6 @@ Page {
}
}
- function maybeSupplementChoices(name, choices)
- {
- if(name == "document-format" && considerAdditionalFormatsSetting.value)
- {
- return choices.concat(printer.additionalDocumentFormats)
- }
- return choices
- }
-
}
VerticalScrollDecorator {}
}
diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml
index 5ff3c38..4ea5595 100644
--- a/qml/pages/SettingsPage.qml
+++ b/qml/pages/SettingsPage.qml
@@ -48,15 +48,6 @@ Page {
}
}
- TextSwitch {
- text: qsTr("Force-include document format")
- description: qsTr("Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.")
- checked: forceIncluDeDocumentFormatSetting.value
- onCheckedChanged: {
- forceIncluDeDocumentFormatSetting.value = checked
- }
- }
-
TextSwitch {
text: qsTr("Remove redundant attributes")
description: qsTr("Remove redundant IPP attributes, if they are also conveyed in the transfer format. Some printers reject the job even if the settings are consistent.")
diff --git a/src/ippmsg.cpp b/src/ippmsg.cpp
index bd6164b..714eaf6 100644
--- a/src/ippmsg.cpp
+++ b/src/ippmsg.cpp
@@ -297,14 +297,23 @@ QByteArray IppMsg::encode(Operation op)
ipp << quint16(op);
ipp << _reqid++;
- if(!_opAttrs.empty())
+
+ ipp << quint8(OpAttrs);
+ // attributes-charset and attributes-natural-language are required to be first
+ // some printers fail if the other mandatory parameters are not in this specific order
+ QStringList InitialAttrs = {"attributes-charset",
+ "attributes-natural-language",
+ "printer-uri",
+ "requesting-user-name"};
+ foreach(QString key, InitialAttrs)
{
- ipp << quint8(1);
- for(QJsonObject::iterator it = _opAttrs.begin(); it != _opAttrs.end(); it++)
- {
- QJsonObject val = it.value().toObject();
- ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
- }
+ QJsonObject val = _opAttrs.take(key).toObject();
+ ipp << encode_attr(val["tag"].toInt(), key, val["value"]);
+ }
+ for(QJsonObject::iterator it = _opAttrs.begin(); it != _opAttrs.end(); it++)
+ { // encode any remaining op-attrs
+ QJsonObject val = it.value().toObject();
+ ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
}
for(QJsonArray::iterator ait = _jobAttrs.begin(); ait != _jobAttrs.end(); ait++)
{
diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp
index 17cab4d..e26aa09 100644
--- a/src/ippprinter.cpp
+++ b/src/ippprinter.cpp
@@ -299,10 +299,10 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray
}
void IppPrinter::print(QJsonObject attrs, QString filename,
- bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantConvertAttrs)
+ bool alwaysConvert, bool removeRedundantConvertAttrs)
{
qDebug() << "printing" << filename << attrs
- << alwaysConvert << forceIncluDeDocumentFormat << removeRedundantConvertAttrs;
+ << alwaysConvert << removeRedundantConvertAttrs;
_progress = "";
emit progressChanged();
@@ -337,6 +337,10 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
QString documentFormat = getAttrOrDefault(attrs, "document-format").toString();
qDebug() << "target format:" << documentFormat << "alwaysConvert:" << alwaysConvert;
+ // document-format goes in the op-attrs and not the job-attrs
+ o.insert("document-format", QJsonObject {{"tag", IppMsg::MimeMediaType}, {"value", documentFormat}});
+ attrs.remove("document-format");
+
documentFormat = targetFormatIfAuto(documentFormat, mimeType, supportedMimeTypes, alwaysConvert);
qDebug() << "adjusted target format:" << documentFormat;
@@ -346,11 +350,6 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
return;
}
- if(!jobCreationAttributes.contains("document-format") && !forceIncluDeDocumentFormat)
- { // Only include if printer supports it
- attrs.remove("document-format");
- }
-
qDebug() << "Printing job" << o << attrs;
QNetworkRequest request;
@@ -404,6 +403,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
attrs.remove("sides");
}
+ qDebug() << "Final op attributes:" << o;
qDebug() << "Final job attributes:" << attrs;
IppMsg job = mk_msg(o, attrs);
diff --git a/src/ippprinter.h b/src/ippprinter.h
index 8c9f6a6..a702aec 100644
--- a/src/ippprinter.h
+++ b/src/ippprinter.h
@@ -54,7 +54,7 @@ signals:
public slots:
void print(QJsonObject attrs, QString file,
- bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantAttributesForRaster);
+ bool alwaysConvert, bool removeRedundantAttributesForRaster);
void onUrlChanged();
diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts
index 101974d..e859f48 100644
--- a/translations/harbour-seaprint-de.ts
+++ b/translations/harbour-seaprint-de.ts
@@ -349,14 +349,6 @@
-
-
-
-
-
-
-
-
diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts
index 29c7396..26b343f 100644
--- a/translations/harbour-seaprint-es.ts
+++ b/translations/harbour-seaprint-es.ts
@@ -349,14 +349,6 @@
Forzar conversión a formato ráster PWG/URF. Esto es para hacer pruebas principalmente.
-
-
- Forzar incluisión de formato de documento
-
-
-
- Forzar la inclusión del atributo de formato de documento. Algunas impresoras tienen problemas para reconocer ciertos formatos, a veces es útil incluir este atributo aunque la impresora no asegure que lo soporte.
-
Eliminar atributos redundantes
diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts
index d9f247e..9a8cddc 100644
--- a/translations/harbour-seaprint-fr.ts
+++ b/translations/harbour-seaprint-fr.ts
@@ -349,14 +349,6 @@
-
-
-
-
-
-
-
-
diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts
index 5beed13..606e38f 100644
--- a/translations/harbour-seaprint.ts
+++ b/translations/harbour-seaprint.ts
@@ -349,14 +349,6 @@
-
-
-
-
-
-
-
-