Fix printing on non-A4 after restructuring

This commit is contained in:
Anton Thomasson 2022-03-23 20:34:38 +01:00
parent ea39f0285b
commit 993eb75cf7
7 changed files with 6 additions and 70 deletions

View file

@ -541,7 +541,7 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
QJsonObject o = opAttrs();
o.insert("job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}});
QString PaperSize = getAttrOrDefault(jobAttrs, "media").toString();
Params.paperSizeName = getAttrOrDefault(jobAttrs, "media").toString(Params.paperSizeName.c_str()).toStdString();
QString targetFormat = getAttrOrDefault(jobAttrs, "document-format").toString();
qDebug() << "target format:" << targetFormat;
@ -573,18 +573,17 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
}
}
if(jobAttrs.contains("media-col") && jobAttrs.contains("media"))
{
qDebug() << "moving media to media-col" << PaperSize;
if(!PaperSizes.contains(PaperSize))
qDebug() << "moving media to media-col" << Params.paperSizeName.c_str();
if(!PaperSizes.contains(Params.paperSizeName.c_str()))
{
emit convertFailed(tr("Unknown document format dimensions"));
emit convertFailed(tr("Unsupported paper size"));
return;
}
int x = PaperSizes[PaperSize].width()*100;
int y = PaperSizes[PaperSize].height()*100;
int x = PaperSizes[Params.paperSizeName.c_str()].width()*100;
int y = PaperSizes[Params.paperSizeName.c_str()].height()*100;
QJsonObject Dimensions =
{{"tag", IppMsg::BeginCollection},
@ -633,11 +632,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
Params.format = PrintParameters::URF;
}
if(!PaperSizes.contains(Params.paperSizeName.c_str()))
{
qDebug() << "Unsupported paper size" << Params.paperSizeName.c_str();
emit convertFailed(tr("Unsupported paper size"));
}
QSizeF size = PaperSizes[Params.paperSizeName.c_str()];
Params.paperSizeUnits = PrintParameters::Millimeters;
Params.paperSizeW = size.width();
@ -688,16 +682,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
}
else
{
if(PaperSize == "")
{
PaperSize = "iso_a4_210x297mm";
}
else if(!PaperSizes.contains(PaperSize))
{
emit convertFailed(tr("Unsupported print media"));
return;
}
QString Sides = getAttrOrDefault(jobAttrs, "sides").toString();
if(Sides=="two-sided-long-edge")

View file

@ -287,10 +287,6 @@
<source>Failed to open file</source>
<translation>Öffnen der Datei fehlgeschlagen</translation>
</message>
<message>
<source>Unsupported print media</source>
<translation>Nicht unterstütztes Druckmedium</translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation>Dateiformat konnte nicht konvertiert werden</translation>
@ -299,10 +295,6 @@
<source>Unknown document format</source>
<translation>Unbekanntes Dokumentenformat</translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation>Unbekannte Dokumentenformat Größe</translation>
</message>
<message>
<source>Preparing</source>
<translation>Vorbereiten</translation>

View file

@ -287,10 +287,6 @@
<source>Failed to open file</source>
<translation>Error al abrir archivo</translation>
</message>
<message>
<source>Unsupported print media</source>
<translation>Medio impreso no soportado</translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation>No se puede convertir este formato de archivo</translation>
@ -299,10 +295,6 @@
<source>Unknown document format</source>
<translation>Formato de documento desconocido</translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation>Dimensiones del formato de documento desconocido</translation>
</message>
<message>
<source>Preparing</source>
<translation>Preparando</translation>

View file

@ -287,10 +287,6 @@
<source>Failed to open file</source>
<translation>Échec de l&apos;ouverture du fichier</translation>
</message>
<message>
<source>Unsupported print media</source>
<translation>Média d&apos;impression non supporté</translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation>Impossible de convertir ce format de fichier</translation>
@ -299,10 +295,6 @@
<source>Unknown document format</source>
<translation>Format de document inconnu</translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation>Format de dimensions du document inconnu</translation>
</message>
<message>
<source>Preparing</source>
<translation>En cours de préparation</translation>

View file

@ -287,10 +287,6 @@
<source>Failed to open file</source>
<translation>Bestand openen mislukt</translation>
</message>
<message>
<source>Unsupported print media</source>
<translation>Niet-ondersteunde afdrukmedia</translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation>Kan dit bestandsformaat niet converteren</translation>
@ -299,10 +295,6 @@
<source>Unknown document format</source>
<translation>Onbekend documentformaat</translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation>Onbekende afmetingen van documentformaat</translation>
</message>
<message>
<source>Preparing</source>
<translation>Voorbereiden</translation>

View file

@ -287,18 +287,10 @@
<source>Failed to open file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown document format</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>

View file

@ -287,10 +287,6 @@
<source>Failed to open file</source>
<translation></translation>
</message>
<message>
<source>Unsupported print media</source>
<translation></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation></translation>
@ -299,10 +295,6 @@
<source>Unknown document format</source>
<translation></translation>
</message>
<message>
<source>Unknown document format dimensions</source>
<translation></translation>
</message>
<message>
<source>Preparing</source>
<translation type="unfinished"></translation>