diff --git a/core/generator.h b/core/generator.h index a5a971b6c..3cf40c2f2 100644 --- a/core/generator.h +++ b/core/generator.h @@ -358,7 +358,8 @@ class OKULAR_EXPORT Generator : public QObject InvalidPrinterStatePrintError, UnableToFindFilePrintError, NoFileToPrintError, - NoBinaryToPrintError + NoBinaryToPrintError, + InvalidPageSizePrintError ///< @since 0.18.2 (KDE 4.12.2) }; /** diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index 1a44523a1..839a32414 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -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" );