0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

.pdf extension will be added to filename if filename has no extension

This commit is contained in:
Arin Alexander 2016-04-07 21:21:48 +04:00
parent ed926de523
commit 43a62bdb7f

View File

@ -278,8 +278,12 @@ void ReportEnginePrivate::printToFile(const QString &fileName)
bool ReportEnginePrivate::printToPDF(const QString &fileName) bool ReportEnginePrivate::printToPDF(const QString &fileName)
{ {
if (!fileName.isEmpty()){ if (!fileName.isEmpty()){
QFileInfo fi(fileName);
QString fn = fileName;
if (fi.suffix().isEmpty())
fn+=".pdf";
QPrinter printer; QPrinter printer;
printer.setOutputFileName(fileName); printer.setOutputFileName(fn);
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
return printReport(&printer); return printReport(&printer);
} }