One of the most important objectives for Kraft is to create business documents of perfect quality. The docs are an important face to the customer and represent the business, so best is just good enough. The old times where invoices got printed on a 24 needle printer in ascii mode should finally be gone 😉
Documents should represent the ‘coorperate identity’, which in small size firms probably comes down to printed stationary with a company logo and some other information on it. Kraft has to print nicely on it. For that it is important that the layout can be configured at all and without compiling Kraft if the customer address should be printed fife millimeters higher for example.
Currently Kraft uses a document template written in RML for the layout. RML is a XML format which can be converted to PDF utilizing a python based command line tool which is called by Kraft. RML is a open source toolkit, quite powerful and mature. However, it does not solve all problems with flexible document creation and sometimes comes a bit unhandy. As a result our eyes are always open for alternatives.
Here are some requirements a template system must provide:
- There is a document template in the file system. It can be changed by the user without recompiling Kraft. Kraft picks it up, fills the document values in and processes it to PDF. Other output formats are optional.
- Layout: Areas where parts of the document are printed can be freely specified, ie. where the address, the date etc. is printed.
- Graphical elements like lines, fixed text, boxes, colors and images can be placed everywhere.
- The system knows at least different layouts for the first page, middle pages and the last page.
- All pages have page header and footer.
- Loops: Since an invoice for example has an unknown amount of items the system must be able to handle that, including clever space management with pagebreaks. Nested loops are possible.
- Maintain areas which must not be split, i.e. an invoice item should be printed completely on one page and not be split by a pagebreak.
- Text faces, paragraph alignment, width, spacing and these kind of things must be configurable in the template.
- Some variables are available such as a page counter.
- Really great would be if the system provides carryover of calculations, like on the top and bottom of each page the so far accumulated sum is printed.
Which free layouting and PDF generating system is able to provide that, preferably Qt/KDE based? Kugar was striving to solve it but when I tested it it did not work out.
Another idea is to use the ability of KWord to work with templates. If Kraft could read KWord templates, fill them and automatically generate a KWord doc from it, that would be a great solution, because in addition to automatic PDF generation documents could easily be exported as KWord docs and changed manually if needed. A great ‘template editor’ also would be available. This would in the direction of office suit integration that commercial Kraft competitors nowadays have.
I am not sure how far we are away from that. Something to investigate.