How to pass the contents of a text or html file to a text document
I am trying to set the contents of a image file to QTextDocument so that i can send it to the printer but i am not able to get the contents of the file in the QTextDocument.
Some thing like following works
But i dont want to pass the string i want the contents of a file. which is not working and the document is empty. Am I not using the addresource porperly. is there any other way to set the file contents to QTextDocument ?
Code:
const QUrl url
= QUrl::fromLocalFile ( "/tmp/test.png" ) ;
if (document->isEmpty())
fprintf(stderr,"Document is empty");