'Pyqt5 Html to PDF(qbytearray)
the printopdf callback function does not return anything, the callback returns an empty object, but I can't see the error in the function.
the code is below:
def _handleLoadFinished(self, ok):
def _QWebEngineCallback(s):
print(s)
if ok:
s = QByteArray()
self.printToPdf(_QWebEngineCallback(s),self._layout)
Solution 1:[1]
thanks, it looks like this:
def _QWebEngineCallback(self,s: bytearray):
pdfs.append(s)
if not self._fetchNext():
QtWidgets.QApplication.quit()
def _handleLoadFinished(self, ok):
if ok:
self.printToPdf(self._QWebEngineCallback,self._layout)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | NestorMotta |