From 43a62bdb7fb41e34da93a63eec0061c14832c17f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 7 Apr 2016 21:21:48 +0400 Subject: [PATCH] .pdf extension will be added to filename if filename has no extension --- limereport/lrreportengine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index baa4e05..7b03f13 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -278,8 +278,12 @@ void ReportEnginePrivate::printToFile(const QString &fileName) bool ReportEnginePrivate::printToPDF(const QString &fileName) { if (!fileName.isEmpty()){ + QFileInfo fi(fileName); + QString fn = fileName; + if (fi.suffix().isEmpty()) + fn+=".pdf"; QPrinter printer; - printer.setOutputFileName(fileName); + printer.setOutputFileName(fn); printer.setOutputFormat(QPrinter::PdfFormat); return printReport(&printer); }