Click here to Skip to main content
13,554,936 members
Click here to Skip to main content
Add your own
alternative version


26 bookmarked
Posted 22 Nov 2003

Printing framework

, 22 Nov 2003
Rate this:
Please Sign up or sign in to vote.
Simple framework for text and graphic Printing/Previewing

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, please be aware of the explicitly stated LGPL license for this code. -- Editor<!-- Add the rest of your HTML here -->

A basic window :

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...

preview textcopy 1/2

preview textcopy 2/2

<!------------------------------- STEP 3 ---------------------------><!-- Add the article text. Please use simple formatting (


etc) -->


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 calculate 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 are 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 active the RTTI and accept some limitations in the choice of resource's name.

    A more traditionnal way is always possible : just add data to your CTextPrinter instance with instruction like :

    textPrinter->AddData("Label", "Value"); 


    LGPL - see /Doc/Licence/Lgpl.txt

  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Thomas Montembault
    United States United States
    No Biography provided

    You may also be interested in...

    Comments and Discussions

    GeneralVector !!! Pin
    ggBuguet28-May-04 2:45
    memberggBuguet28-May-04 2:45 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web01 | 2.8.180515.1 | Last Updated 23 Nov 2003
    Article Copyright 2003 by Thomas Montembault
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid