import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QLabel()
path = r"C:UsersShauryaDocumentsTo be savedhello.pdf"
# or
# path = QDir.home().filePath(r"DocumentsTo be savedhello.pdf")
# or
# path = QDir(QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)).filePath(r"To be savedhello.pdf")
url = bytearray(QUrl.fromLocalFile(path).toEncoded()).decode() # file:///C:/Users/Shaurya/Documents/To%20be%20saved/hello.pdf
text = "<a href={}>Reference Link> </a>".format(url)
w.setText(text)
w.setOpenExternalLinks(True)
w.show()
sys.exit(app.exec_())