2012-02-27 39 views
0

我正在使用QWebKit呈現PDF頁面。直到現在,我使用setHtml()將html代碼提供給QMainFrame,然後render()來打印內容或將其導出爲pdf。到目前爲止這麼好,但我想使用setContent()將內聯svg圖像包含在框架中,該框架不會顯示,使用setHtml()使用QWebFrame.setContent()與unicode(Python + PySide)

setContent()只接受QByteArray,並且html代碼是unicode。如何將unicode字符串提供給setContent()

回答

1

unicode中獲取字節數組的方法是對其進行編碼。