phpDocumentor Aprint
[ Back ] [ class tree: Aprint ] [ index: Aprint ] [ all elements ]

Class: APrint

Source Location: /aprint.php

Class APrint

Direct descendents
Child Class Description
PSPrint

[ Top ]
Property Summary
boolean   $AutoNewPage  
array   $CallBacks   Callbacks array. Ths index holdsall callback defined.
array   $CallBacksParm   Parameters for the callbacks functions
bool   $ConnectionOpened   I've already established a connection to the printer?
mixed   $CurrentFont   handler of current selected font
integer   $FontH   Value for the font height
array   $FontTable   array with all created font
mixed   $FontW   Value for the font width
resource   $hPrinter   printer handler
string   $JobTitle   Job name
mixed   $MarginBottom   Margins, size of the bottom margin
mixed   $MarginLeft   Margins, size of the left margin
mixed   $MarginRight   Margins, size of the right margin
mixed   $MarginTop   Margins, size of the top margin
array   $NewPageHeader   Array containing texts to print as header into each page Also, into the array are stored the font id request to print the text You may set different font to each row.
mixed   $NPag   Page counter
mixed   $PaperDimX   Paper hight
mixed   $PaperDimY   Paper width
string   $PrinterName   Selected printer (Windows name)
boolean   $PrintPageFooter   Should this module print its own page footer. If set to
integer   $Res_X   Orizontal resolution
integer   $Res_Y   Vertical resolution
integer   $row   Current row
mixed   $ScriptId  
array   $ValidCallbacks   Array holding the supported callbacks
array   $ValidMeasure   Array holding the supported unit of measure used by movement function.

[ Top ]
Method Summary
APrint   APrint()   Initialize this class. It doesn not attempt to
void   BlankRow()   Skip a row, left a blank row.
integer   Conv2Twip_x()   Convert the printer point size into internal point size according to its resolution
integer   Conv2Twip_y()  
void   CreateFont()   Create a new font
array   GetPageSize()   Retrieve the page size
void   HeaderText()   Write an header at the top of the first page.
void   Line()   Draw a dash line.
boolean   MvAbsolutePos()   Move the currentline to nRow. It return TRUE on success,
boolean   MvBottom()   Move to the last row before the bottom margin It return TRUE on success, FALSE otherwise.
boolean   MvRelativePos()   Move the currentline up or down of nRow rows. It return TRUE on success,
boolean   MvTop()   Move to the first row after the top margin It return TRUE on success,
void   NewPage()   Close the current page and start a new one.
void   OpenPrinter()   Start the connection to the printer. This is the public interface to _OpenPrinter.
void   PrintPageHeader()   Print the page header
integer   ResConv_x()   Convert the internal point size to the printer point size according to its resolution
integer   ResConv_y()  
void   run()   Close the output to the printer and start to print
boolean   SetAutoNewPage()   Set the AutoNewPage flag. If set to true, the module call the functionNewPage
void   SetBottomMargin()   Set the size for the bottom margin
void   SetCallBack()   Set the callback function
void   SetLeftMargin()   Set the size for the left margin
void   SetMargin()   Useful function to setup all margins with one function use -1 to skip the parameter
void   SetPageHeader()   Setup the text to print on each page.
void   SetPrinter()   Specifiy which printer I'll use. If you don't give any printer, the default printer will be used.
void   SetPrintFooter()   Set if the module should print its own footer or not.
void   SetRightMargin()   Set the size for the right margin
void   SetTopMargin()   Set the size for the top margin
void   Text()   printout the text
void   TextFooter()   Print the given text as page footer
void   TextXY()   printout the text at the exact position requested
void   _BeginCol()   This function compute the starting position given the
boolean   _CalculatePos()   Internal function used to calculate the movement.
void   _CheckMarginValue()   Check the value for the margin. They should be >0 and less then the page size
void   _DefaultFont()   Define some dafault font
void   _DefinePageSize()   inizialize all parameter about the page size Require a printer handler.
void   _FooterNote()   Printout page number and script name as footer
void   _OpenPrinter()   Establish the connection to the printer
void   _SetFont()   Activate the specified font

[ Top ]
Properties
boolean   $AutoNewPage [line 230]
API Tags:
See:  APrint::SetAutoNewPage()


[ Top ]
array   $CallBacks [line 187]

Callbacks array. Ths index holdsall callback defined.

Each index map to a particular function that supports the callback The supported call back are: 'newpage' -> Call the function each time just before execute the 'NewPage' function code

API Tags:
See:  APrint::$CallBacksParm
See:  SetCallBack();
See:  APrint::NewPage()


[ Top ]
array   $CallBacksParm [line 193]

Parameters for the callbacks functions

API Tags:
See:  APrint::$CallBacks


[ Top ]
bool   $ConnectionOpened [line 88]

I've already established a connection to the printer?

(TRUE/FALSE)


[ Top ]
mixed   $CurrentFont [line 132]

handler of current selected font


[ Top ]
integer   $FontH [line 117]

Value for the font height


[ Top ]
array   $FontTable [line 165]

array with all created font

API Tags:
See:  APrint::CreateFont()


[ Top ]
mixed   $FontW [line 122]

Value for the font width


[ Top ]
resource   $hPrinter [line 94]

printer handler


[ Top ]
string   $JobTitle [line 172]

Job name

API Tags:
See:  APrint::_OpenPrinter()


[ Top ]
mixed   $MarginBottom [line 150]

Margins, size of the bottom margin


[ Top ]
mixed   $MarginLeft [line 154]

Margins, size of the left margin


[ Top ]
mixed   $MarginRight [line 158]

Margins, size of the right margin


[ Top ]
mixed   $MarginTop [line 146]

Margins, size of the top margin


[ Top ]
array   $NewPageHeader [line 225]

Array containing texts to print as header into each page Also, into the array are stored the font id request to print the text You may set different font to each row.

API Tags:
See:  SetNewPageHeader()


[ Top ]
mixed   $NPag [line 127]

Page counter


[ Top ]
mixed   $PaperDimX [line 137]

Paper hight


[ Top ]
mixed   $PaperDimY [line 142]

Paper width


[ Top ]
string   $PrinterName [line 82]

Selected printer (Windows name)


[ Top ]
boolean   $PrintPageFooter = TRUE [line 209]

Should this module print its own page footer. If set to

false, you may supply your custom footer using TextFooter and 'newpage' callback

API Tags:
See:  APrint::SetPrintFooter()
See:  APrint::TextFooter()
See:  APrint::NewPage()


[ Top ]
integer   $Res_X [line 106]

Orizontal resolution


[ Top ]
integer   $Res_Y [line 111]

Vertical resolution


[ Top ]
integer   $row [line 100]

Current row


[ Top ]
mixed   $ScriptId [line 174]

[ Top ]
array   $ValidCallbacks = array('newpage') [line 199]

Array holding the supported callbacks

API Tags:
See:  APrint::SetCallBack()


[ Top ]
array   $ValidMeasure = array('row','mm','inch','twip') [line 217]

Array holding the supported unit of measure used by movement function.

API Tags:
See:  APrint::MvAbsolutePos()
See:  APrint::MvRelativePos()


[ Top ]
Methods
Constructor APrint  [line 239]

  APrint APrint( [string $TitleText = ""], [string $ScriptId = ""]  )

Initialize this class. It doesn not attempt to

establish the connection to the printer This class will perform this job at the first time that you send any text

Parameters:
string   $TitleText:  document title
string   $ScriptId:  script identification

API Tags:
Access:  public


[ Top ]
BlankRow  [line 538]

  void BlankRow( )

Skip a row, left a blank row.


API Tags:
Access:  public


[ Top ]
Conv2Twip_x  [line 887]

  integer Conv2Twip_x( integer $value  )

Convert the printer point size into internal point size according to its resolution

As internal unit I use the twip. 1 inch = 1440 twip, 1 mm = 56,7 twip

Parameters:
integer   $value: 

API Tags:
See:  APrint::ResConv_y()
See:  APrint::ResConv_x()
See:  APrint::Conv2Twip_y()
Access:  private


[ Top ]
Conv2Twip_y  [line 897]

  integer Conv2Twip_y( integer $value  )

Parameters:
integer   $value: 

API Tags:
See:  APrint::Conv2Twip_x()


[ Top ]
CreateFont  [line 785]

  void CreateFont( [string $fName = "Courier new"], [integer $fHeight = 336], [integer $fWidth = 168], [integer $fWeight = 400], [boolean $fItalic = false], [boolean $fUnderline = false], [boolean $fStrikeout = false], [mixed $fOrientaton = 0], integer $fOrientation  )

Create a new font

Parameters:
string   $fName:  Font Name, default: Courier New
integer   $fHeight:  Font height, default: 336
integer   $fWidth:  Font width, default: 168
integer   $fWeight:  Font weight, default: 400. 0 -> thin, 800 -> bold
boolean   $fItalic:  Italic script? True/False
boolean   $fUnderline:  Text with underline? True/False
boolean   $fStrikeout:  True/False
integer   $fOrientation:  Should be always 3 digits, i.e 020. See printer_create_font in the note to the manual

API Tags:
Access:  public
See:  APrint::Text()
See:  APrint::_SetFont()


Redefined in descendants as:

[ Top ]
GetPageSize  [line 1019]

  array GetPageSize( )

Retrieve the page size


API Tags:
Return:  (width,length)
Access:  public


[ Top ]
HeaderText  [line 524]

  void HeaderText( string $TitleText, [integer $hFont = -1]  )

Write an header at the top of the first page.

Parameters:
integer   $hFont:  font handle returned by CreateFont
string   $TitleText:  Text to print

API Tags:
See:  CreateFont();
Access:  public


[ Top ]
Line  [line 711]

  void Line( )

Draw a dash line.


API Tags:
Access:  public


[ Top ]
MvAbsolutePos  [line 949]

  boolean MvAbsolutePos( integer $nUnit, [string $unit = 'row']  )

Move the currentline to nRow. It return TRUE on success,

FALSE otherwise

Parameters:
integer   $nUnit:  Numebr of 'unit' it must be greater then zero
string   $unit:  measurement used to set the movement

API Tags:
Access:  public


[ Top ]
MvBottom  [line 978]

  boolean MvBottom( integer $nRow  )

Move to the last row before the bottom margin It return TRUE on success, FALSE otherwise.

Notice: the bottom is calculated using as row hight the current font

Parameters:
integer   $nRow:  New current line number

API Tags:
Access:  public


[ Top ]
MvRelativePos  [line 930]

  boolean MvRelativePos( integer $nUnit, [string $unit = 'row']  )

Move the currentline up or down of nRow rows. It return TRUE on success,

FALSE otherwise

Parameters:
integer   $nUnit:  Numebr of 'unit' may be less or greater then zero
string   $unit:  measurement used to set the movement

API Tags:
Access:  public


[ Top ]
MvTop  [line 964]

  boolean MvTop( )

Move to the first row after the top margin It return TRUE on success,

FALSE otherwise


API Tags:
Access:  public


[ Top ]
NewPage  [line 732]

  void NewPage( )

Close the current page and start a new one.


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
OpenPrinter  [line 835]

  void OpenPrinter( [string $PrinterName = ""]  )

Start the connection to the printer. This is the public interface to _OpenPrinter.

Parameters:
string   $PrinterName:  Name of the printer to use. If not set use the system default

API Tags:
See:  APrint::_OpenPrinter()
Access:  public


[ Top ]
PrintPageHeader  [line 608]

  void PrintPageHeader( )

Print the page header


API Tags:
See:  APrint::Text()
Access:  public


Redefined in descendants as:

[ Top ]
ResConv_x  [line 862]

  integer ResConv_x( integer $value  )

Convert the internal point size to the printer point size according to its resolution

As internal unit I use the twip. 1 inch = 1440 twip, 1 mm = 56,7 twip

Parameters:
integer   $value: 

API Tags:
See:  APrint::ResConv_y()
Access:  private


[ Top ]
ResConv_y  [line 872]

  integer ResConv_y( integer $value  )

Parameters:
integer   $value: 

API Tags:
See:  APrint::ResConv_x()


[ Top ]
run  [line 720]

  void run( )

Close the output to the printer and start to print


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
SetAutoNewPage  [line 510]

  boolean SetAutoNewPage( boolean $bool  )

Set the AutoNewPage flag. If set to true, the module call the functionNewPage

automatically at the end of the page, if set to off, the user must call the NewPage function

Parameters:
boolean   $bool: 

API Tags:
Return:  The function returns the old value
See:  APrint::NewPage()


[ Top ]
SetBottomMargin  [line 414]

  void SetBottomMargin( integer $value  )

Set the size for the bottom margin

Parameters:
integer   $value: 

API Tags:
Access:  public


[ Top ]
SetCallBack  [line 367]

  void SetCallBack( string $callback, mixed $func, array $parm  )

Set the callback function

Parameters:
string   $callback:  which callback apply the function
mixed   $func:  function name or array holding object and method (see call_uzer_func_array manual page for more detail)
array   $parm:  parameters to pass to the function

API Tags:
See:  APrint::$CallBacks
See:  APrint::$ValidCallbacks
Access:  public


[ Top ]
SetLeftMargin  [line 424]

  void SetLeftMargin( integer $value  )

Set the size for the left margin

Parameters:
integer   $value: 

API Tags:
Access:  public


[ Top ]
SetMargin  [line 386]

  void SetMargin( integer $top, [integer $bottom = -1], [integer $left = -1], [integer $right = -1]  )

Useful function to setup all margins with one function use -1 to skip the parameter

Parameters:
integer   $top:  top margin size
integer   $bottom:  bottom margin size
integer   $left:  left margiclass
integer   $right:  right margin size

API Tags:
Access:  public


Redefined in descendants as:
  • PSPrint::SetMargin() : Useful function to setup all margins with one function use -1 to skip the parameter

[ Top ]
SetPageHeader  [line 474]

  void SetPageHeader( mixed $Text, [mixed $fontArray = array()], [mixed $OnFirstPage = true]  )

Setup the text to print on each page.

The text, passed as array, allow you to pass many rows ( 1 row = 1 item).


API Tags:
Access:  public


[ Top ]
SetPrinter  [line 447]

  void SetPrinter( string $Name  )

Specifiy which printer I'll use. If you don't give any printer, the default printer will be used.

Parameters:
string   $Name:  printer name as defined in Window

API Tags:
Access:  public


Redefined in descendants as:
  • PSPrint::SetPrinter() : Specify which printer I'll use. PSPrint does not use any printer, but write its content into file, therefore this function is meaningless. Call SetFileName instead. It exists to avoid to broke the interface.

[ Top ]
SetPrintFooter  [line 459]

  void SetPrintFooter( bool $print  )

Set if the module should print its own footer or not.

Parameters:
bool   $print:  TRUE=print its own page footer

API Tags:
Access:  public


[ Top ]
SetRightMargin  [line 435]

  void SetRightMargin( integer $value  )

Set the size for the right margin

Parameters:
integer   $value: 

API Tags:
Access:  public


[ Top ]
SetTopMargin  [line 404]

  void SetTopMargin( integer $value  )

Set the size for the top margin

Parameters:
integer   $value: 

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
Text  [line 555]

  void Text( string $text, [integer $hFont = -1], [integer $align = AP_LEFT], [integer $col = 0]  )

printout the text

Parameters:
string   $text:  text to printout
integer   $hFont:  Handle to the font to use. Handle returned by CreateFont
integer   $align:  text alignment
integer   $col:  Orizontal position where start to print the text. This value will be added to the left margin.

API Tags:
See:  APrint::TextFooter()
See:  APrint::CreateFont()
Access:  public


Redefined in descendants as:

[ Top ]
TextFooter  [line 650]

  void TextFooter( string $text, [integer $hFont = -1], [integer $align = AP_LEFT], [integer $col = 0]  )

Print the given text as page footer

Parameters:
string   $text:  text to printout
integer   $hFont:  Handle to the font to use. Handle returned by CreateFont
integer   $align:  text alignment
integer   $col:  Orizontal position where start to print the text. This value will be added to the left margin.

API Tags:
See:  APrint::Text()
See:  APrint::CreateFont()
Access:  public


Redefined in descendants as:

[ Top ]
TextXY  [line 585]

  void TextXY( integer $Xpos, integer $Ypos, string $text, [integer $hFont = -1]  )

printout the text at the exact position requested

Parameters:
string   $text:  text to printout
integer   $hFont:  Handle to the font to use. Handle returned by CreateFont
integer   $Xpos:  orizontal position
integer   $Ypos:  vertical position where print the text

API Tags:
See:  APrint::Text()
See:  APrint::CreateFont()
Access:  public


Redefined in descendants as:

[ Top ]
_BeginCol  [line 684]

  void _BeginCol( integer $align, integer $textWidth, integer $col  )

This function compute the starting position given the

text alignment, the left margin and the starting column

Parameters:
integer   $align:  text alignment
integer   $textWidth:  text width
integer   $col:  Orizontal position where start to print the text. This value will be added to the left margin.

API Tags:
See:  APrint::Text()
See:  APrint::TextFooter()
Access:  private


[ Top ]
_CalculatePos  [line 991]

  boolean _CalculatePos( integer $nUnit, string $unit  )

Internal function used to calculate the movement.

Parameters:
integer   $nUnit:  Numebr of 'unit' may be less or greater then zero
string   $unit:  measurement used to set the movement

API Tags:
Access:  public


[ Top ]
_CheckMarginValue  [line 329]

  void _CheckMarginValue( )

Check the value for the margin. They should be >0 and less then the page size


API Tags:
Access:  private


Redefined in descendants as:
  • PSPrint::_CheckMarginValue() : Check the value for the margin. They should be >0 and less then the page size. The PSPrint version, before to call the APrint method check whether the page size is set.

[ Top ]
_DefaultFont  [line 845]

  void _DefaultFont( )

Define some dafault font


API Tags:
Access:  private


Redefined in descendants as:

[ Top ]
_DefinePageSize  [line 270]

  void _DefinePageSize( )

inizialize all parameter about the page size Require a printer handler.

Unit used: twip,

  1. inch = 1440 twip
  1. mm = 56.7 twip


API Tags:
Access:  private


Redefined in descendants as:

[ Top ]
_FooterNote  [line 757]

  void _FooterNote( )

Printout page number and script name as footer


API Tags:
Access:  private


Redefined in descendants as:

[ Top ]
_OpenPrinter  [line 807]

  void _OpenPrinter( )

Establish the connection to the printer


API Tags:
Access:  private


Redefined in descendants as:

[ Top ]
_SetFont  [line 909]

  void _SetFont( [int $fnt = -1]  )

Activate the specified font

Parameters:
int   $fnt:  font handle returned by CreateFont

API Tags:
See:  APrint::CreateFont()
Access:  private


Redefined in descendants as:

[ Top ]

Documentation generated on Sun, 13 Feb 2005 22:02:51 +0100 by phpDocumentor 1.3.0RC3