Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to Make a Invoice Document
i need to make printables documents, for a billing software. I already saw some reports tools, but i don't know if is the best way to go. Can someone give me sugestion how can i or should i, try to implement this function?
In some report soft, they used xml, to make the doc template. But i read QT documentacion about QTextDocument and i think that it can be a option. I a newbie so i really don't know what option should i go.
Can someone help me?
Thanks for all the sugestions and tips
Sure. Using a QTextDocument is an option. Or you directly render your document on a QPrinter (which can also produce a PDF). I have been digging into reporting tools lately, and came to the conclusion that the state is rather sad in Qt land. There are a few offerings. NCReports and KD-Reports are the commercial solutions I found that look reasonable, though NCReports seems more capable and more actively developed but with lower quality documentation and KD-Reports seems a bit dead and too expensive for what it offers. What I found in terms of open source solutions, all seems either abandoned (eXaro for instance) or too immature to be useful for our purposes. Most reporting tools also seem really focused on big printouts with long lists of data from an SQL dataset.
For one of our applications, we've build our own system based on an XML template that renders elements like images and rich text snippets to a QPrinter via the QPainter API. It works, but we're not really happy with it.
I have some ideas of how this can be done better in this time and age, but they so far are just ideas in my head. Not a single line of code was written...
targat last edited by
[quote author="targat" date="1391726529"]try this
Exactly what I mean by "immature". Don't get me wrong: I think it is a fine initiative and a good start, but I don't think it is suitable for enterprise use (yet).
thks for the tips.
i will take a look at openRPT.
Another question Andre. Trying to render a document direct on a Qprinter, its easy to control page format? like borders and things like that?
And by render my doc directly to Qprinter, you mean my QtextDocument, or a a widget? i was thinking that may be possible create a widget that simulates the look of the invoice, and render the widget to printer insteed of monitor. Is that possible? if so, what is the correlation between qt units and metric units.
Using widgets is possible, but I would not recommend it. You'll get into issues with scales and resolutions of paper and printers being completely different.
What I was referring to, is that you can simply create a QPainter on a QPrinter, and use the QPainter primitives to do the rendering of the elements you need. Directly at the right resolution for the printer.
i see, im gona investigate it. Thanks for the help man!