Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to open a pdf loaded in resource file?
I want to show the help file for my application when the user clicks on the link.
I have created a resource file and then I have changed resource file .qrc to .py file.
Now I don't know how to get that pdf file and show it from .py file. In .py file the pdf file is written as binary code.
@Selvajothi You can store the PDF content as temp file and show that temp file then.
I tried this but it is not working
destinationTemp = QDir.fromNativeSeparators(path)#path is a local directory
fileName = "manual"
QFile.copy("qrc:/newPrefix/text.pdf", destinationTemp + fileName + ".pdf")
QDesktopServices.openUrl(QUrl.fromLocalFile(destinationTemp + fileName + ".pdf"))
try it with
Pablo J. Rogina last edited by Pablo J. Rogina
it is not working
what is not working? please describe...
Are you able to see the temp file being created on disk?
If so, are you able to open such file with an external PDF viewer?
If so, what happens if you double click/select such file from the OS? is any default application launching? I mean, are you sure the PDF extension has a default app linked to it in your OS?
@J-Hilk Thank you . It is working now
Pablo J. Rogina last edited by
It is working now
It would be great if you could explain what way you solved the issue.
In addition, please don't forget to mark your post as solved then!
I have changed ":/newPrefix/text.pdf" from "qrc:/newPrefix/text.pdf"