PDA

View Full Version : How to convert XML+XSL to PDF in QT4.5



richardander
20th March 2009, 23:22
Hi all,

My application output XML+XSL so that they can be displayed in a browser.

If I would like to convert XML + XSL result to a PDF, can QT4.5 does this?

In the Qt4.5 (http://library.forum.nokia.com/index.jsp?topic=/Qt_for_S60_Developers_Library/GUID-ECBE8350-9D54-48D1-B777-264B895B9063/porting4.html)page, it says : "The QtXmlPatterns module has been extended to cover XSLT... A common application of this is the transformation of XML data into human-readable formats for reporting purposes ... XSLT makes it simple to reformat XML content without changing data structures, removes the need for an intermediate DOM layer for presentation, and enables rapid solutions to be created; for example, creating reports as HTML or PDF."

Thank you!

P.S. sample code is highly appreciated!

wysota
21st March 2009, 00:14
XSL-Transformations usually output XML data. If you manage to convert it to something from which you can generate a PDF, then you'll be able to do that. But you have to do that conversion yourself, Qt won't help you much with it. The only thing that can be used out of the box is to use XSL-T to get HTML and then either use WebKit with QWebFrame::render() or QTextDocument with QTextDocument::print().