--- a/WebBrowser/Tools/PrintToPdfDialog.py Sat Sep 24 18:00:30 2016 +0200 +++ b/WebBrowser/Tools/PrintToPdfDialog.py Tue Sep 27 19:41:11 2016 +0200 @@ -9,7 +9,9 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot, QMarginsF +import os + +from PyQt5.QtCore import pyqtSlot, QMarginsF, QStandardPaths from PyQt5.QtGui import QPageLayout, QPageSize from PyQt5.QtPrintSupport import QPrinter, QPageSetupDialog from PyQt5.QtWidgets import QDialog @@ -40,6 +42,13 @@ self.pdfFilePicker.setFilters(self.tr( "PDF Files (*.pdf);;" "All Files (*)")) + if not os.path.isabs(filePath): + documentsPath = QStandardPaths.writableLocation( + QStandardPaths.DocumentsLocation) + if documentsPath: + filePath = os.path.join(documentsPath, filePath) + else: + filePath = os.path.abspath(filePath) self.pdfFilePicker.setText(filePath, toNative=True) self.__currentPageLayout = QPageLayout(