void MainWindow::on_actionSave_Document_triggered()
{
QString fileName = QFileDialog::getSaveFileName(this, "Save document...", qApp->applicationDirPath(), "*.pdf");
if (!fileName.isEmpty())
{
QPrinter printer;
printer.setFullPage(true);
printer.setPaperSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
ui->textEdit->document()->print(&printer);
}
}