Why ObjectPrinter

 

Grids are used in almost all cases of query or output of Application Programs.

But still, separated coding was needed for print out them, which is extremely inefficient lowering the program productivity .

 

As different methods are used for each report tools, unified source management is actually impossible.

And moreover, it is uncertain if the report tools can be used in compilers of different versions.

 

 Therefore ObjectrPrinter is developed to make up for these problems and promote the programming productivity.

Also, this program is very easy to use, applicable to all versions, and powerful for high quality outputs, applying user¡¯s needs at maximum.

 

 

Featurings of ObjectPrinter

 

l        Fast to apply.

Almost of Delphi¡¯s visible components can be printed out by simple coding.

 

l        Easy to use

Simple Commands and Properties.    Almost nothing to learn. Any Delphi user can immediately use it

 

l        Grids can be printed exactly including User Defined shapes.(OnDrawCell)

 

l        With the help of the Stretch function, unnecessary page division can be prevented.

 

l        1, 2 or 4 sheets can be printed in one page.

 

l        Applicable on all existing Delphi programs.

 

l         Objects capable for output

       1.  StringGrid

    2. DbGrid

     3. DrawGrid

     4. Calendar

     5. Memo

     6. ListBox

     7. RichEdit

     8. RealGrid

     9. Other Custom Grids

10. Image

11. Panel & groupBox with it¡¯s child controls

 

 

l        Report Title function (MainTitle & SubTitle)

l        Page Footer function

l        Logo apply function

l        Preview (Zoom in & Zoom Out , Orientation , Stretch )

 

 

 

Functions of ObjectPrinter

 

Function

Parameters

Usage

ClearObject

 

Clear the existing defined Object 

AddObject

AddObject(Value : TObject);

Define the Object to print.

The order of output is the same as the defined order.

 

Applicable Objects :

TStringGrid,

TDrawGrid,

Tcalendar,

TMemo,

TListBox,

TRichEdit,

TImage,

TrealGrid(in Korean Version)

Other visible object(s) 

AddSetObject

AddSetObject(Value :TObject;

aAlignment : Talignment

aLEFT,aTOP : integer);

AddObject function with definable alignment and output position.

Value aTop and aLeft is the value to be added or subtracted from the position of the former Object output.

The alignment of AddObject is taLeftjustify

GetObjectPage

GetObjectPage(aObject : TObject) : integer;

Get the start page for output from an Object.

GetObjectPos

GetObjectPos(aObject : TObject) : Tpoint;

Get the start point for output from an Object

GetObjectRect

GetObjectRect(aObject : TObject;

aPAGE : integer) : TRect;

 Same as MergeObject but only performs when Execute is performed

AdjObjectPos

AdjObjectPos(aObject:TObject;

aLeft,aTOP : integer);

Define the output position of an Object defined by AddObject

Value atop and aLeft is the value to be added or subtracted from the position of the former Object output

AddSubTitle

AddSubTitle(Value : string;

aFont : TFont;

aAlignment : TAlignment);

 Define the SubTitle to print. MainTitle and SubTitle is printed every page

AddSetSubTitle

AddSubTitle(Value : string;

aFont : TFont;

aAlignment : Talignment

Feed : boolean );

 Define the SubTitle to print and it¡¯s font and alignmemt.

If feed is false then next subtitle will be appeare at same

line.

AddSkip

 

Manually skip page

AddStrings

AddStrings(aStrings : Array of String

aAlignment : Talignment

aLEFT,aTOP : integer);

Define strings to print out.

AddText

AddText(lFileName : string;

aAlignment : Talignment

aLEFT,aTOP : integer);

Define file to print out.

 File Type : TextFile & RTF File

MergeObject

MergeObject(SourceObject: TObject;

TargetImage : TImage;

AutoSize:boolean);

Objects of a single parent are made into a single image file resize the image into the standard of the TargetImage

If the value for Autosize is True, the image is sized in the ratio of the TargetImage on the PaperSize

Define the TargetImage altered by MergeObject with the Addobject function

PrepareMergeObject

PrepareMergeObject(SourceObject: TObject;

TargetImage : TImage;

AutoSize:boolean)

 Same as MergeObject but only performs when Execute is performed

Execute

 

Do preview & Output  

Print

 

Do Print out with out preview

 

 

 

Properties of ObjectPrinter

 

Property

Type

Usage

LogoPicture

TGraphic

Here a bitmap (Tbitmap) can be inputted, which will be printed on paper at bottom-right area.

 

This property can be used for instance for the purpose of printing a business logo at the top of the page

GridDrawScale

integer

Rate to shrink Grid(s)

 

MainTitle

string

Text to print at the top side of the printed page

Doesn¡¯t print when null

MainTitleAlignment

Talignment

taLeftJustify,

taCenter,

taRightJustify

Alignment for the Main Title

MainTitleFont

TFont

Font of the Main Title

MarginLeft

integer

Distance to the left side of the page.

MarginTop

integer

Distance to the top side of the page.

Orientation

TprinterOrientation

poPortrait,

poLandscape

Input of the direction of printing

(poPortrait and poLandscape)

Default value is poPortrait 

PreviewScale

integer

Preview Scale

PutTail

Boolean

Whether or not to print the Footer

(for instance page numbers, time, date and business logo).

Stretch

Boolean

Whether or not to Stretch the Column of the Grid

fit to paper width

OnDrawPage

TDrawPageEvent =

procedure (Canvas : TCanvas;

Page : integer;

Rect: TRect) of object;

Event that to execute after preparing every page

OnMergeObject

TMergeObjectEvent  =

procedure (Sender : TObject;

Count : integer) of object;

Event that to execute on case of MergeObject

OnBeforePage

TDrawPageEvent =

procedure (Canvas : TCanvas;

Page : integer;

Rect: TRect) of object;

Event that to execute before preparing every page

 

 

 

Examples of ObjectPrinter

 

   Ex-1 )   With ObjectPrinter1 do

               begin

                 ClearObject;

                 AddObject(StringGrid1);

                 Execute;

                 //Print;

             end;

 

   Ex-2 )   With ObjectPrinter1 do

               begin

                 ClearObject;

                 AddObject(StringGrid1);

                 AdjObjectPos(StringGrid1,100,100);

                 Execute;

             end;

 

   Ex-3 )   With ObjectPrinter1 do

               begin

                 ClearObject;

                 AddSetObject(StringGrid1,taCenter,0,100);

                 Execute;

             end;

 

   Ex-4 )   With ObjectPrinter1 do

               begin

                 ClearObject;

                 AddObject(StringGrid1);

                 AddSubTitle('This Line is subtitle-1',NIL,taLeftJustify);

                 AddSubTitle('This Line is subtitle-2',NIL,taCenter);

                 AddSubTitle('This Line is subtitle-3',NIL,taRightJustify);

                 Execute;

             end;

 

   Ex-5 )  With ObjectPrinter1 do

              begin

                ClearObject;

                PrepareMergeObject(ScrollBox1,Image2,TRUE);

                AddObject(Image2);

                Execute;

            end;

 

 

   Ex-6 )  With ObjectPrinter1 do

              begin

                ClearObject;

                for i:=1 to 3 do

                  begin

                    PrepareMergeObject(ScrollBox1,Image2,TRUE);

                    AddObject(Image2);

                end;

                Execute;

            end;

 

            procedure TForm1.ObjectPrinter1MergeObject(Sender: TObject; Count: Integer);

            var i,j : integer;

            begin

               if (Sender=Image2) and (Count=1) then Edit1.Text:='MERGE'+'First'

               else                                    Edit1.Text:='MERGE'+IntTostr(Count);

            end;

 

   Ex-7 )   With ObjectPrinter1 do

               begin

                 ClearObject;

                 AddObject(StringGrid1);

                 Execute;

             end;

 

             procedure TForm1.ObjectPrinter1DrawPage(Canvas: TCanvas; Page: Integer;

             Rect:  TRect);

             var lP : integer;

             var lTOPLEFT : TPoint;

             var lRECT : TRect;

             begin

                lP:=ObjectPrinter1.GetObjectPage(StringGrid1);

                if lP=PAGE then

                  begin

                     lTOPLEFT:=ObjectPrinter1.GetObjectPos(StringGrid1);

                     Canvas.TextOut(lTOPLEFT.X,lTOPLEFT.Y-Canvas.TextHeight('Yy')-2

                                    ,'Here is top of stringgrid1');

                end;

               Canvas.Draw(10,10,Image1.Picture.Graphic);

             end;

 

 

TObjectPrinter V 2.0     

created by Oh Ik-Hwan / mail to econo5@hotmail.com

 

Copy Right(s) 2003 Technovalley Co.,Ltd Seoul,Korea

 

www.ObjectPrinter.com / www.Oprinter.com