From b7b587d099341ce424bf9b9f79ac055f843ce0b8 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Fri, 5 Jun 2020 21:01:59 +0200 Subject: [PATCH] Make alwaysConvert do something again --- src/ippprinter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 1cd4e73..dff703e 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -276,9 +276,13 @@ QString firstMatch(QJsonArray supported, QStringList wanted) return ""; } -QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray supportedMimeTypes) +QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray supportedMimeTypes, bool forceRaster) { - if(documentFormat == "application/octet-stream") + if(forceRaster) + { + return firstMatch(supportedMimeTypes, {"image/pwg-raster", "image/urf"}); + } + else if(documentFormat == "application/octet-stream") { if(mimeType == "application/pdf") { @@ -329,9 +333,9 @@ void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert) QJsonArray jobCreationAttributes = _attrs["job-creation-attributes-supported"].toObject()["value"].toArray(); QString documentFormat = getAttrOrDefault(attrs, "document-format").toString(); - qDebug() << "target format:" << documentFormat; + qDebug() << "target format:" << documentFormat << "alwaysConvert:" << alwaysConvert; - documentFormat = targetFormatIfAuto(documentFormat, mimeType, supportedMimeTypes); + documentFormat = targetFormatIfAuto(documentFormat, mimeType, supportedMimeTypes, alwaysConvert); qDebug() << "adjusted target format:" << documentFormat; if(documentFormat == "" || documentFormat == "application/octet-string")