The documentation for this article, which appears to be quite extensive, is in French, as are the source code comments. If you need translation, you can http://world.altavista.com/. Also, please be aware of the explicitly stated LGPL license for this code. -- Editor
A basic window:
The component provides a hardcopy print & print preview. (In this case, no custom header/footer)
The picture shows the preview for a 'text' preview. The framework calculates the number of pages. The user simply has to put data in a CPrinterText
instance. In this case, we use a derived class to customize the header and the footer...
Introduction
The source contains PDF and HTML documentation with UML schema, refactoring & a using section. A small demonstration project is also present in this zip.
The code simplifies the print and preview of a window. The main idea is to provide a canvas for obtain a 'textual view' of the data.
Users have just to describe the contains of a windows in a CDocText
. The framework calculates the number of characters per page and the number of pages.
The formatting is simple but sufficient for current needs:
- Customize header & footer
- Bold or normal fonts
- EmptyLine, Title, Data=(Label, Value), List
FreeText and FreeTable
Using the Code
The printer DLL contains all the code. So the $Devp\bin must be in the $PATH
to execute the program 'test.exe' (or you must copy the DLL in your source project).
All the source is in the namespace printer, so use instruction like using namespace printer;
to access classes.
The directory 'Test' contains a small demo. In this project, we show how we can use a factory to simplify the creation of textual view. In this particular case, the project must activate the RTTI and accept some limitations in the choice of resource's name.
A more traditional way is always possible: just add data to your CTextPrinter
instance with instruction like:
textPrinter->AddTitle("Title");
textPrinter->AddData("Label", "Value");
...
Licence
- LGPL - See /Doc/Licence/Lgpl.txt
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.