View Full Version : problem with qwebview

27th September 2010, 14:27
I'm developing a simple bill generator. For that i have to use HTML to format the output, and generate a pdf file or print a bill.
In the first module, the output goes to a pdf file, formatted using html.

I can use QTextDocument, and then its setHtml() function, but it does not have good looks [older version of css i guess]

i tried to use QWebView, it looked superb [in the pdf file], except that, the logo was not visible. so, <img> is not working.

I searched everywhere for its solution, and tried these:

- use a png file instead of jpg file
- copy/paste the folder imageformats from plugins directory to current directory
- give the absolute path [i gave "file:///home/user/Bill.jpg"]
- set base url [i set "file:///home/user/Bill" as base url]

none of the above solutions worked.

what should i do to get images there?

or is there any alternative to QWebView? or any thing which i can use for printing better quality bills?

27th September 2010, 14:45
Did you compile qt yourself and may you forgot the image librarys?

If not then I would try to add the picture to my resource file and to load it then.

27th September 2010, 16:27
i did it using qt creator

and it is showing the image when i'm using qtextdocument.sethtml()

27th September 2010, 16:57

i used the same code, in a new project.

when i'm displaying the html on the QWebView, it is showing the image. but the image is not present when it is printing to a file using qprinter.

any suggestions?

27th September 2010, 17:02
got it.!!!

i had to wait for the images to load... so i used the signal webview's signal loadFinished().. and that did the job :D