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,
quint32 HwResX, quint32 HwResY, bool TwoSided, bool Tumble)
{
if(urf)
if(urf && (HwResX != HwResY))
{ // URF only supports symmetric resolutions
if(HwResX < HwResY)
{
HwResY = HwResX;
}
else {
HwResX = HwResY;
}
qDebug() << "Unsupported URF resolution" << PaperSize;
tempfile->deleteLater();
emit failed(tr("Unsupported resolution (dpi)"));
return;
}
QString ShortPaperSize;
@ -147,6 +144,14 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
bool urf, quint32 Colors, quint32 Quality, QString PaperSize,
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))
{
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 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();
QString PrintColorMode = getAttrOrDefault(attrs, "print-color-mode").toString();

View file

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

View file

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

View file

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

View file

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

View file

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