How to close the Pdf file while closing the application?
Unsolved
General and Desktop
-
I have a pyqt5 application in which I have opened a pdf now when the user exits the application pdf should also close.
I have tried the followingdestinationTemp = QDir.fromNativeSeparators(path) if os.path.exists(destinationTemp + fileName + ".pdf"): os.remove(destinationTemp + fileName + ".pdf") QFile.copy(":/newPrefix/sample.pdf", destinationTemp + fileName + ".pdf") QDesktopServices.openUrl(QUrl.fromLocalFile(" destinationTemp + fileName + ".pdf"))
-
Hi
Well you ask the OS to open any app that is tied to the extension pdf.
Its not really possible to ask it to close without using platform native api calls
to find this window and try to close it.You could use
https://doc.qt.io/qt-5/qtpdf-index.html
to display the pdf yourself and hence be able to close the pdf view.