Click here to Skip to main content
Click here to Skip to main content

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 http://world.altavista.com/Also, 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).

hardcopy

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

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 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->AddTitle("Title"); 
    textPrinter->AddData("Label", "Value"); 
    ...
    

    Licence

    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

    Comments and Discussions

     
    GeneralVector !!! PinmemberggBuguet28-May-04 2:45 
    GeneralDocumentation PinmemberDavidCrow26-Feb-04 10:49 
    Generallglplgl PinmemberTeaShirt24-Nov-03 3:51 
    Well compared to some of the fab work people put here on this site with no (spelled none) strings attached, this is a bit pretentious. Isn't it? Don't get me wrong, protect your work as much as you want. I know I try. But simple stuff coming with strings attached is funny. May be I need to understand the plglplg stuff more.
     
    yalcinConfused | :confused:
     
    flame on.

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

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

    | Advertise | Privacy | Mobile
    Web03 | 2.8.140721.1 | Last Updated 23 Nov 2003
    Article Copyright 2003 by Thomas Montembault
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid