Don't try to print something with invalid sizes

Unfortunately as we can't add new strings to stable versions it'd say "unwnown error" if that happens
Don't think it's too bad since this shouldn't be happening much

BUGS: 329562
remotes/origin/KDE/4.13
Albert Astals Cid 12 years ago
parent 031a8cd1d7
commit 0aec32fc7d
  1. 3
      core/generator.h
  2. 7
      generators/poppler/generator_pdf.cpp

@ -358,7 +358,8 @@ class OKULAR_EXPORT Generator : public QObject
InvalidPrinterStatePrintError,
UnableToFindFilePrintError,
NoFileToPrintError,
NoBinaryToPrintError
NoBinaryToPrintError,
InvalidPageSizePrintError ///< @since 0.18.2 (KDE 4.12.2)
};
/**

@ -1116,6 +1116,13 @@ bool PDFGenerator::print( QPrinter& printer )
int width = printer.width();
int height = printer.height();
#endif
if (width <= 0 || height <= 0)
{
lastPrintError = InvalidPageSizePrintError;
return false;
}
// Create the tempfile to send to FilePrinter, which will manage the deletion
KTemporaryFile tf;
tf.setSuffix( ".ps" );

Loading…
Cancel
Save