@@ -541,7 +541,7 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
541
541
QJsonObject o = opAttrs ();
542
542
o.insert (" job-name" , QJsonObject {{" tag" , IppMsg::NameWithoutLanguage}, {" value" , fileinfo.fileName ()}});
543
543
544
- QString PaperSize = getAttrOrDefault (jobAttrs, " media" ).toString ();
544
+ Params. paperSizeName = getAttrOrDefault (jobAttrs, " media" ).toString (Params. paperSizeName . c_str ()). toStdString ();
545
545
546
546
QString targetFormat = getAttrOrDefault (jobAttrs, " document-format" ).toString ();
547
547
qDebug () << " target format:" << targetFormat;
@@ -573,18 +573,17 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
573
573
}
574
574
}
575
575
576
-
577
576
if (jobAttrs.contains (" media-col" ) && jobAttrs.contains (" media" ))
578
577
{
579
- qDebug () << " moving media to media-col" << PaperSize ;
580
- if (!PaperSizes.contains (PaperSize ))
578
+ qDebug () << " moving media to media-col" << Params. paperSizeName . c_str () ;
579
+ if (!PaperSizes.contains (Params. paperSizeName . c_str () ))
581
580
{
582
- emit convertFailed (tr (" Unknown document format dimensions " ));
581
+ emit convertFailed (tr (" Unsupported paper size " ));
583
582
return ;
584
583
}
585
584
586
- int x = PaperSizes[PaperSize ].width ()*100 ;
587
- int y = PaperSizes[PaperSize ].height ()*100 ;
585
+ int x = PaperSizes[Params. paperSizeName . c_str () ].width ()*100 ;
586
+ int y = PaperSizes[Params. paperSizeName . c_str () ].height ()*100 ;
588
587
589
588
QJsonObject Dimensions =
590
589
{{" tag" , IppMsg::BeginCollection},
@@ -633,11 +632,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
633
632
Params.format = PrintParameters::URF;
634
633
}
635
634
636
- if (!PaperSizes.contains (Params.paperSizeName .c_str ()))
637
- {
638
- qDebug () << " Unsupported paper size" << Params.paperSizeName .c_str ();
639
- emit convertFailed (tr (" Unsupported paper size" ));
640
- }
641
635
QSizeF size = PaperSizes[Params.paperSizeName .c_str ()];
642
636
Params.paperSizeUnits = PrintParameters::Millimeters;
643
637
Params.paperSizeW = size.width ();
@@ -688,16 +682,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
688
682
}
689
683
else
690
684
{
691
- if (PaperSize == " " )
692
- {
693
- PaperSize = " iso_a4_210x297mm" ;
694
- }
695
- else if (!PaperSizes.contains (PaperSize))
696
- {
697
- emit convertFailed (tr (" Unsupported print media" ));
698
- return ;
699
- }
700
-
701
685
QString Sides = getAttrOrDefault (jobAttrs, " sides" ).toString ();
702
686
703
687
if (Sides==" two-sided-long-edge" )
0 commit comments