Move URF resolution fix to IppPrinter

...so it can be sent in the attributes
This commit is contained in:
Anton Thomasson 2020-06-01 21:56:47 +02:00
parent a42dbbc682
commit 2c1c6e4dc5
7 changed files with 50 additions and 8 deletions

View file

@ -35,15 +35,12 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
bool urf, quint32 Colors, quint32 Quality, QString PaperSize, bool urf, quint32 Colors, quint32 Quality, QString PaperSize,
quint32 HwResX, quint32 HwResY, bool TwoSided, bool Tumble) quint32 HwResX, quint32 HwResY, bool TwoSided, bool Tumble)
{ {
if(urf) if(urf && (HwResX != HwResY))
{ // URF only supports symmetric resolutions { // URF only supports symmetric resolutions
if(HwResX < HwResY) qDebug() << "Unsupported URF resolution" << PaperSize;
{ tempfile->deleteLater();
HwResY = HwResX; emit failed(tr("Unsupported resolution (dpi)"));
} return;
else {
HwResX = HwResY;
}
} }
QString ShortPaperSize; QString ShortPaperSize;
@ -147,6 +144,14 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
bool urf, quint32 Colors, quint32 Quality, QString PaperSize, bool urf, quint32 Colors, quint32 Quality, QString PaperSize,
quint32 HwResX, quint32 HwResY) quint32 HwResX, quint32 HwResY)
{ {
if(urf && (HwResX != HwResY))
{ // URF only supports symmetric resolutions
qDebug() << "Unsupported URF resolution" << PaperSize;
tempfile->deleteLater();
emit failed(tr("Unsupported resolution (dpi)"));
return;
}
if(!PaperSizes.contains(PaperSize)) if(!PaperSizes.contains(PaperSize))
{ {
qDebug() << "Unsupported paper size" << PaperSize; qDebug() << "Unsupported paper size" << PaperSize;

View file

@ -319,6 +319,23 @@ void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert){
quint32 HwResX = PrinterResolutionRef.toObject()["x"].toInt(); quint32 HwResX = PrinterResolutionRef.toObject()["x"].toInt();
quint32 HwResY = PrinterResolutionRef.toObject()["y"].toInt(); quint32 HwResY = PrinterResolutionRef.toObject()["y"].toInt();
if(target == UrfConvert)
{ // Ensure symmetric resolution for URF
if(HwResX < HwResY)
{
HwResY = HwResX;
}
else
{
HwResX = HwResY;
}
QJsonObject tmpObj;
tmpObj["units"] = PrinterResolutionRef.toObject()["units"];
tmpObj["x"] = (int)HwResX;
tmpObj["y"] = (int)HwResY;
attrs["printer-resolution"] = tmpObj;
}
quint32 Quality = getAttrOrDefault(attrs, "print-quality").toInt(); quint32 Quality = getAttrOrDefault(attrs, "print-quality").toInt();
QString PrintColorMode = getAttrOrDefault(attrs, "print-color-mode").toString(); QString PrintColorMode = getAttrOrDefault(attrs, "print-color-mode").toString();

View file

@ -136,6 +136,10 @@
<source>Unsupported paper size</source> <source>Unsupported paper size</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsupported resolution (dpi)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -136,6 +136,10 @@
<source>Unsupported paper size</source> <source>Unsupported paper size</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsupported resolution (dpi)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -136,6 +136,10 @@
<source>Unsupported paper size</source> <source>Unsupported paper size</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsupported resolution (dpi)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -136,6 +136,10 @@
<source>Unsupported paper size</source> <source>Unsupported paper size</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsupported resolution (dpi)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -136,6 +136,10 @@
<source>Unsupported paper size</source> <source>Unsupported paper size</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsupported resolution (dpi)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>