OpenPetra
Free Administration Software for Non-Profits
Ict.Common.Printing.TPrinter Class Referenceabstract

The TPrinter class helps to print. More...

Inheritance diagram for Ict.Common.Printing.TPrinter:
Ict.Common.Printing.TGfxPrinter Ict.Common.Printing.TTxtPrinter Ict.Common.Printing.TPdfPrinter

Public Member Functions

virtual void SaveState ()
 save the state before a rotation etc More...
 
virtual void RestoreState ()
 restore the state after a rotation etc More...
 
virtual void RotateAtTransform (double ADegrees, double XPos, double YPos)
 rotate the following output by some degrees, at the given position More...
 
abstract float LineFeed (eFont AFont)
 Line Feed; increases the current y position by the height of the given font More...
 
virtual float LineFeed ()
 Line Feed; increases the current y position by the height of the biggest last used font More...
 
float LineFeed (float height)
 Line Feed; increases the current y position by the given height More...
 
abstract float LineSpaceFeed (eFont AFont)
 Line Feed, but not full line; increases the current y position by half the height of the given font More...
 
abstract float LineUnFeed (eFont AFont)
 Reverse Line Feed; decreases the current y position by the height of the given font More...
 
abstract Boolean ValidXPos (float APosition)
 Is the given position still on the page? More...
 
abstract Boolean ValidYPos ()
 Is the current line still on the page? More...
 
abstract float LineFeedToPageFooter ()
 Jump to the position where the page footer starts. SetPageFooterSpace is used to define the space reserved for the footer. More...
 
abstract void SetPageFooterSpace (System.Int32 ANumberOfLines, eFont AFont)
 Set the space that is required by the page footer. ValidYPos will consider this value. More...
 
abstract void SetHasMorePages (bool AHasMorePages)
 Tell the printer, that there are more pages coming More...
 
abstract bool HasMorePages ()
 more pages are coming More...
 
abstract float Cm (float AValueInCm)
 Converts the given value in cm to the currently used measurement unit More...
 
abstract float PixelHorizontal (float AValueInPixel)
 Converts the given value in pixel to the currently used measurement unit, using the horizontal resolution More...
 
abstract float PixelVertical (float AValueInPixel)
 Converts the given value in pixel to the currently used measurement unit, using the vertical resolution More...
 
abstract Boolean PrintString (String ATxt, eFont AFont, eAlignment AAlign)
 prints into the current line, aligned x position More...
 
abstract Boolean PrintString (String ATxt, eFont AFont, float AXPos)
 prints into the current line, absolute x position More...
 
abstract bool PrintString (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign)
 prints into the current line, absolute x position with width and alignment More...
 
virtual bool PrintStringWrap (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign)
 prints into the current line, absolute x position with width and alignment this method uses FCurrentXPos and FCurrentYPos to be able to continue a paragraph uses FCurrentXPos and FCurrentYPos to know where to start to print, and also sets valid values in those member variables More...
 
abstract Boolean PrintStringAndFits (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign)
 This function uses the normal DrawString function to print into a given space. More...
 
abstract float GetWidthString (String ATxt, eFont AFont)
 Return the width of the string, if it was printed in one line, using the given Font More...
 
abstract Boolean DrawLine (float AXPos1, float AXPos2, eLinePosition ALinePosition, eFont AFont)
 Draws a line, either above or below the current text line the font is required to get the height of the row More...
 
virtual void DrawLine (Int32 APenPixels, float AXPos1, float AYPos1, float AXPos2, float AYPos2)
 Draws a line, at specified position More...
 
virtual void DrawRectangle (Int32 APenPixels, float AXPos, float AYPos, float AWidth, float AHeight)
 draws a rectangle More...
 
virtual void DrawBitmap (string APath, float AXPos, float AYPos)
 todoComment More...
 
virtual void DrawBitmap (string APath, float AXPos, float AYPos, float AWidth, float AHeight, float AWidthPercentage, float AHeightPercentage)
 Draw a bitmap. More...
 
 TPrinter ()
 constructor More...
 
virtual void Init (eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
 sets the orientation of the page More...
 
void StartSimulatePrinting ()
 start the simulation of printing; nothing is actually printed, but the CurrentYPos is increased More...
 
void FinishSimulatePrinting ()
 finish the simulation of printing; the actual CurrentYPos is restored More...
 
void PushCurrentState ()
 store the current printer state (font size etc) More...
 
void PopCurrentState ()
 return to previous printer state; this is used for printing table cells More...
 
void PopCurrentStateApartFromYPosition ()
 return to previous printer state; but keep the new y position (used eg. for printing the page header) More...
 
float Inch (float AValueInInch)
 Converts the given value in inch to the currently used measurement unit; uses Inch2Cm and Cm More...
 
virtual void InsertDocument (string AFilename)
 insert another document into the current document. At the moment only used for PDF More...
 
virtual float PrintTable (float AXPos, float AWidthAvailable, List< TTableRowGfx >rows, out Int32 ARowsFittingOnPage)
 renders a table at the current FCurrentYPos does not support rowspan at the moment colspan might be implemented in the generation of the TTableRowGfx structure does not care about fitting on page etc. More...
 

Static Public Member Functions

static float Cm2Inch (float AValueInCm)
 Converts the given value in cm to the equivalent value in inches More...
 
static float Inch2Cm (float AValueInInch)
 Converts the given value in inches to the equivalent value in centimeters More...
 

Protected Attributes

eOrientation FOrientation
 todoComment More...
 
eMarginType FMarginType
 use printable area or default margins More...
 
Int32 FNumberOfPages
 todoComment More...
 
float FPageFooterSpace
 how much space is needed for the footer lines; footerspace = font.height number of lines More...
 
float FLeftMargin
 todoComment More...
 
float FTopMargin
 todoComment More...
 
float FRightMargin
 todoComment More...
 
float FBottomMargin
 todoComment More...
 
float FWidth
 todoComment More...
 
float FHeight
 todoComment More...
 
TPrinterLayout FPrinterLayout
 todoComment More...
 
TPrinterState FCurrentState = new TPrinterState()
 current state of printer More...
 
PrintAction FprintAction
 I can check whether I'm printing to a preview or a real printer. More...
 

Properties

System.Int32 CurrentPageNr [get, set]
 todoComment More...
 
System.Int32 CurrentDocumentNr [get, set]
 a document can consist of several pages; a document is one body element More...
 
System.Int32 NumberOfPages [get, set]
 this only has a valid value after the first rendering of the report More...
 
float CurrentYPos [get, set]
 todoComment More...
 
float CurrentXPos [get, set]
 todoComment More...
 
float AnchorXPos [get, set]
 other elements can be positioned relative to this position More...
 
float AnchorYPos [get, set]
 other elements can be positioned relative to this position More...
 
float LeftMargin [get]
 todoComment More...
 
float RightMargin [get]
 todoComment More...
 
eFont CurrentFont [get, set]
 todoComment More...
 
float CurrentLineHeight [get, set]
 1 is the normal height of the font, CurrentLineHeight is multiplied with the height of the font More...
 
float CurrentRelativeFontSize [get, set]
 the relative font size; 0 is default size More...
 
eAlignment CurrentAlignment [get, set]
 todoComment More...
 
ePrintingMode PrintingMode [get, set]
 this is about simulation or printing More...
 
float Width [get]
 todoComment More...
 
float PageFooterSpace [get]
 todoComment More...
 

Detailed Description

The TPrinter class helps to print.

This is a generic class for printing. Most of the functions are abstract and need to be implemented by a derived class. This is TxtPrinter and GfxPrinter, that are derived from TPrinter

Constructor & Destructor Documentation

◆ TPrinter()

Ict.Common.Printing.TPrinter.TPrinter ( )
inline

constructor

Member Function Documentation

◆ Cm()

abstract float Ict.Common.Printing.TPrinter.Cm ( float  AValueInCm)
pure virtual

Converts the given value in cm to the currently used measurement unit

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ Cm2Inch()

static float Ict.Common.Printing.TPrinter.Cm2Inch ( float  AValueInCm)
inlinestatic

Converts the given value in cm to the equivalent value in inches

Returns
void

◆ DrawBitmap() [1/2]

virtual void Ict.Common.Printing.TPrinter.DrawBitmap ( string  APath,
float  AXPos,
float  AYPos 
)
inlinevirtual

todoComment

Parameters
APath
AXPos
AYPos

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.

◆ DrawBitmap() [2/2]

virtual void Ict.Common.Printing.TPrinter.DrawBitmap ( string  APath,
float  AXPos,
float  AYPos,
float  AWidth,
float  AHeight,
float  AWidthPercentage,
float  AHeightPercentage 
)
inlinevirtual

Draw a bitmap.

Either Width or WidthPercentage should be unequals 0, but only one should have a value. Same applies to Height

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.

◆ DrawLine() [1/2]

abstract Boolean Ict.Common.Printing.TPrinter.DrawLine ( float  AXPos1,
float  AXPos2,
eLinePosition  ALinePosition,
eFont  AFont 
)
pure virtual

Draws a line, either above or below the current text line the font is required to get the height of the row

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ DrawLine() [2/2]

virtual void Ict.Common.Printing.TPrinter.DrawLine ( Int32  APenPixels,
float  AXPos1,
float  AYPos1,
float  AXPos2,
float  AYPos2 
)
inlinevirtual

Draws a line, at specified position

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.

◆ DrawRectangle()

virtual void Ict.Common.Printing.TPrinter.DrawRectangle ( Int32  APenPixels,
float  AXPos,
float  AYPos,
float  AWidth,
float  AHeight 
)
inlinevirtual

draws a rectangle

Returns
void

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.

◆ FinishSimulatePrinting()

void Ict.Common.Printing.TPrinter.FinishSimulatePrinting ( )
inline

finish the simulation of printing; the actual CurrentYPos is restored

Returns
void

◆ GetWidthString()

abstract float Ict.Common.Printing.TPrinter.GetWidthString ( String  ATxt,
eFont  AFont 
)
pure virtual

Return the width of the string, if it was printed in one line, using the given Font

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ HasMorePages()

abstract bool Ict.Common.Printing.TPrinter.HasMorePages ( )
pure virtual

more pages are coming

Returns

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ Inch()

float Ict.Common.Printing.TPrinter.Inch ( float  AValueInInch)
inline

Converts the given value in inch to the currently used measurement unit; uses Inch2Cm and Cm

Returns
void

◆ Inch2Cm()

static float Ict.Common.Printing.TPrinter.Inch2Cm ( float  AValueInInch)
inlinestatic

Converts the given value in inches to the equivalent value in centimeters

Returns
void

◆ Init()

virtual void Ict.Common.Printing.TPrinter.Init ( eOrientation  AOrientation,
TPrinterLayout  APrinterLayout,
eMarginType  AMarginType 
)
inlinevirtual

sets the orientation of the page

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ InsertDocument()

virtual void Ict.Common.Printing.TPrinter.InsertDocument ( string  AFilename)
inlinevirtual

insert another document into the current document. At the moment only used for PDF

Parameters
AFilename

Reimplemented in Ict.Common.Printing.TPdfPrinter.

◆ LineFeed() [1/3]

virtual float Ict.Common.Printing.TPrinter.LineFeed ( )
inlinevirtual

Line Feed; increases the current y position by the height of the biggest last used font

Returns
the new current line

Reimplemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ LineFeed() [2/3]

abstract float Ict.Common.Printing.TPrinter.LineFeed ( eFont  AFont)
pure virtual

Line Feed; increases the current y position by the height of the given font

Returns
the new current line

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ LineFeed() [3/3]

float Ict.Common.Printing.TPrinter.LineFeed ( float  height)
inline

Line Feed; increases the current y position by the given height

Returns
the new current line

◆ LineFeedToPageFooter()

abstract float Ict.Common.Printing.TPrinter.LineFeedToPageFooter ( )
pure virtual

Jump to the position where the page footer starts. SetPageFooterSpace is used to define the space reserved for the footer.

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ LineSpaceFeed()

abstract float Ict.Common.Printing.TPrinter.LineSpaceFeed ( eFont  AFont)
pure virtual

Line Feed, but not full line; increases the current y position by half the height of the given font

Returns
the new current line

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ LineUnFeed()

abstract float Ict.Common.Printing.TPrinter.LineUnFeed ( eFont  AFont)
pure virtual

Reverse Line Feed; decreases the current y position by the height of the given font

Returns
the new current line

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PixelHorizontal()

abstract float Ict.Common.Printing.TPrinter.PixelHorizontal ( float  AValueInPixel)
pure virtual

Converts the given value in pixel to the currently used measurement unit, using the horizontal resolution

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PixelVertical()

abstract float Ict.Common.Printing.TPrinter.PixelVertical ( float  AValueInPixel)
pure virtual

Converts the given value in pixel to the currently used measurement unit, using the vertical resolution

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PopCurrentState()

void Ict.Common.Printing.TPrinter.PopCurrentState ( )
inline

return to previous printer state; this is used for printing table cells

◆ PopCurrentStateApartFromYPosition()

void Ict.Common.Printing.TPrinter.PopCurrentStateApartFromYPosition ( )
inline

return to previous printer state; but keep the new y position (used eg. for printing the page header)

◆ PrintString() [1/3]

abstract Boolean Ict.Common.Printing.TPrinter.PrintString ( String  ATxt,
eFont  AFont,
eAlignment  AAlign 
)
pure virtual

prints into the current line, aligned x position

Returns
true if something was printed

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PrintString() [2/3]

abstract Boolean Ict.Common.Printing.TPrinter.PrintString ( String  ATxt,
eFont  AFont,
float  AXPos 
)
pure virtual

prints into the current line, absolute x position

Returns
true if something was printed

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PrintString() [3/3]

abstract bool Ict.Common.Printing.TPrinter.PrintString ( String  ATxt,
eFont  AFont,
float  AXPos,
float  AWidth,
eAlignment  AAlign 
)
pure virtual

prints into the current line, absolute x position with width and alignment

Returns
true if something was printed

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PrintStringAndFits()

abstract Boolean Ict.Common.Printing.TPrinter.PrintStringAndFits ( String  ATxt,
eFont  AFont,
float  AXPos,
float  AWidth,
eAlignment  AAlign 
)
pure virtual

This function uses the normal DrawString function to print into a given space.

Returns
whether the text did fit that space or not.

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PrintStringWrap()

virtual bool Ict.Common.Printing.TPrinter.PrintStringWrap ( String  ATxt,
eFont  AFont,
float  AXPos,
float  AWidth,
eAlignment  AAlign 
)
inlinevirtual

prints into the current line, absolute x position with width and alignment this method uses FCurrentXPos and FCurrentYPos to be able to continue a paragraph uses FCurrentXPos and FCurrentYPos to know where to start to print, and also sets valid values in those member variables

Returns
s bool true if any text was printed

Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ PrintTable()

virtual float Ict.Common.Printing.TPrinter.PrintTable ( float  AXPos,
float  AWidthAvailable,
List< TTableRowGfx rows,
out Int32  ARowsFittingOnPage 
)
inlinevirtual

renders a table at the current FCurrentYPos does not support rowspan at the moment colspan might be implemented in the generation of the TTableRowGfx structure does not care about fitting on page etc.

Parameters
AXPosthe X position to start the table
AWidthAvailableAWidthAvailable
rows
ARowsFittingOnPagenumber of rows that fitted on the page
Returns
height of table

◆ PushCurrentState()

void Ict.Common.Printing.TPrinter.PushCurrentState ( )
inline

store the current printer state (font size etc)

◆ RestoreState()

virtual void Ict.Common.Printing.TPrinter.RestoreState ( )
inlinevirtual

restore the state after a rotation etc

Reimplemented in Ict.Common.Printing.TPdfPrinter.

◆ RotateAtTransform()

virtual void Ict.Common.Printing.TPrinter.RotateAtTransform ( double  ADegrees,
double  XPos,
double  YPos 
)
inlinevirtual

rotate the following output by some degrees, at the given position

Reimplemented in Ict.Common.Printing.TPdfPrinter.

◆ SaveState()

virtual void Ict.Common.Printing.TPrinter.SaveState ( )
inlinevirtual

save the state before a rotation etc

Reimplemented in Ict.Common.Printing.TPdfPrinter.

◆ SetHasMorePages()

abstract void Ict.Common.Printing.TPrinter.SetHasMorePages ( bool  AHasMorePages)
pure virtual

Tell the printer, that there are more pages coming

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ SetPageFooterSpace()

abstract void Ict.Common.Printing.TPrinter.SetPageFooterSpace ( System.Int32  ANumberOfLines,
eFont  AFont 
)
pure virtual

Set the space that is required by the page footer. ValidYPos will consider this value.

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, Ict.Common.Printing.TPdfPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ StartSimulatePrinting()

void Ict.Common.Printing.TPrinter.StartSimulatePrinting ( )
inline

start the simulation of printing; nothing is actually printed, but the CurrentYPos is increased

Returns
void

◆ ValidXPos()

abstract Boolean Ict.Common.Printing.TPrinter.ValidXPos ( float  APosition)
pure virtual

Is the given position still on the page?

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

◆ ValidYPos()

abstract Boolean Ict.Common.Printing.TPrinter.ValidYPos ( )
pure virtual

Is the current line still on the page?

Returns
void

Implemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TTxtPrinter.

Member Data Documentation

◆ FBottomMargin

float Ict.Common.Printing.TPrinter.FBottomMargin
protected

todoComment

◆ FCurrentState

TPrinterState Ict.Common.Printing.TPrinter.FCurrentState = new TPrinterState()
protected

current state of printer

◆ FHeight

float Ict.Common.Printing.TPrinter.FHeight
protected

todoComment

◆ FLeftMargin

float Ict.Common.Printing.TPrinter.FLeftMargin
protected

todoComment

◆ FMarginType

eMarginType Ict.Common.Printing.TPrinter.FMarginType
protected

use printable area or default margins

◆ FNumberOfPages

Int32 Ict.Common.Printing.TPrinter.FNumberOfPages
protected

todoComment

◆ FOrientation

eOrientation Ict.Common.Printing.TPrinter.FOrientation
protected

todoComment

◆ FPageFooterSpace

float Ict.Common.Printing.TPrinter.FPageFooterSpace
protected

how much space is needed for the footer lines; footerspace = font.height number of lines

◆ FprintAction

PrintAction Ict.Common.Printing.TPrinter.FprintAction
protected

I can check whether I'm printing to a preview or a real printer.

◆ FPrinterLayout

TPrinterLayout Ict.Common.Printing.TPrinter.FPrinterLayout
protected

todoComment

◆ FRightMargin

float Ict.Common.Printing.TPrinter.FRightMargin
protected

todoComment

◆ FTopMargin

float Ict.Common.Printing.TPrinter.FTopMargin
protected

todoComment

◆ FWidth

float Ict.Common.Printing.TPrinter.FWidth
protected

todoComment

Property Documentation

◆ AnchorXPos

float Ict.Common.Printing.TPrinter.AnchorXPos
getset

other elements can be positioned relative to this position

◆ AnchorYPos

float Ict.Common.Printing.TPrinter.AnchorYPos
getset

other elements can be positioned relative to this position

◆ CurrentAlignment

eAlignment Ict.Common.Printing.TPrinter.CurrentAlignment
getset

todoComment

◆ CurrentDocumentNr

System.Int32 Ict.Common.Printing.TPrinter.CurrentDocumentNr
getset

a document can consist of several pages; a document is one body element

◆ CurrentFont

eFont Ict.Common.Printing.TPrinter.CurrentFont
getset

todoComment

◆ CurrentLineHeight

float Ict.Common.Printing.TPrinter.CurrentLineHeight
getset

1 is the normal height of the font, CurrentLineHeight is multiplied with the height of the font

◆ CurrentPageNr

System.Int32 Ict.Common.Printing.TPrinter.CurrentPageNr
getset

todoComment

◆ CurrentRelativeFontSize

float Ict.Common.Printing.TPrinter.CurrentRelativeFontSize
getset

the relative font size; 0 is default size

◆ CurrentXPos

float Ict.Common.Printing.TPrinter.CurrentXPos
getset

todoComment

◆ CurrentYPos

float Ict.Common.Printing.TPrinter.CurrentYPos
getset

todoComment

◆ LeftMargin

float Ict.Common.Printing.TPrinter.LeftMargin
get

todoComment

◆ NumberOfPages

System.Int32 Ict.Common.Printing.TPrinter.NumberOfPages
getset

this only has a valid value after the first rendering of the report

◆ PageFooterSpace

float Ict.Common.Printing.TPrinter.PageFooterSpace
get

todoComment

◆ PrintingMode

ePrintingMode Ict.Common.Printing.TPrinter.PrintingMode
getset

this is about simulation or printing

◆ RightMargin

float Ict.Common.Printing.TPrinter.RightMargin
get

todoComment

◆ Width

float Ict.Common.Printing.TPrinter.Width
get

todoComment


The documentation for this class was generated from the following file: