Class: PSPrint
Source Location: /psprint.php
Class PSPrint
Inherited Properties, Constants, and Methods
Property Summary
resource |
$hDoc |
Document handler |
integer |
$Orientation |
Paper orientation, supported only by ps module |
Method Summary
PSPrint |
PSPrint() |
Initialize this class. It does not attempt to |
void |
NewPage() |
Close the current page and start the new one. |
void |
OpenFileName() |
Start the connection to the printer. This is the public interface to _OpenPrinter. |
void |
run() |
Close the output. |
void |
SetFontPath() |
Set the path where the font file .afm are located. The Postscript module require Notice: if the ps module is not created, the class store the information until it will be created and then set the given path. |
void |
SetMargin() |
Useful function to setup all margins with one function use -1 to skip the parameter |
void |
SetPageSize() |
The page size. This function accept the well known page forms |
void |
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. |
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 |
_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. |
void |
_DefinePageSize() |
The Aprint module take the page size from the printer. Here the user must provide the |
void |
_FooterNote() |
Printout page number and script name as footer |
void |
_OpenPrinter() |
Open the output printer (APrint) or the output file (PSPrint) |
void |
_SetFont() |
Activate the specified font |
integer |
_VPoint() |
The ps module set the point zero to the bottom edge of the page, the module has its point zero on the top edge, the function converts the vertical value from both systems. |
Properties
Paper orientation, supported only by ps module
Methods
PSPrint PSPrint(
[string
$TitleText = ""], [string
$ScriptId = ""]
)
|
|
Initialize this class. It does not attempt to
open the output file 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:
void CreateFont(
[string
$fName = "Courier"], [integer
$fHeight = 240], [integer
$fWidth = 120], [integer
$fWeight = 400], [boolean
$fItalic = false], [boolean
$fUnderline = false], [boolean
$fStrikeout = false], [mixed
$fOrientaton = 0], integer
$fOrientation
)
|
|
Create new font
Parameters:
string |
$fName: |
Font Name. Set the path to the font file. The ps extension should take the path from the function set_pathname, but on my system it doesn't work (ps 1.3.0 + pslib 0.2.5). So I must provide here the full pathname (absolute or relative) to the font file |
integer |
$fHeight: |
Font height, default: 336 |
integer |
$fWidth: |
Font width, default: 168 (PsPrint unused) |
integer |
$fWeight: |
Font weight, default: 400. 0 -> thin, 800 -> bold (PsPrint unused) |
boolean |
$fItalic: |
Italic script? True/False (PsPrint unused) |
boolean |
$fUnderline: |
Text with underline? True/False |
boolean |
$fStrikeout: |
True/False (PsPrint unused) |
integer |
$fOrientation: |
Should be always 3 digits, i.e 020. See printer_create_font in the note to the manual (PsPrint unused) |
API Tags:
Redefinition of:
- APrint::CreateFont()
- Create a new font
Close the current page and start the new one.
API Tags:
Redefinition of:
- APrint::NewPage()
- Close the current page and start a new one.
void OpenFileName(
[string
$FileName = ""]
)
|
|
Start the connection to the printer. This is the public interface to _OpenPrinter.
Parameters:
string |
$FileName: |
Name of the printer to use. If not set use the system default |
API Tags:
Close the output.
API Tags:
Redefinition of:
- APrint::run()
- Close the output to the printer and start to print
void SetCustomPageSize(
integer
$DimX, integer
$DimY, integer
$Orientation
)
|
|
Set custom page size. The dimension must be points.
- inch = 1440 points
- mm = 56.7 twip
Parameters:
integer |
$DimX: |
|
integer |
$DimY: |
|
integer |
$Orientation: |
|
API Tags:
void SetFileName(
string
$Name
)
|
|
Set the name of the file to write
Parameters:
API Tags:
void SetFontPath(
string
$Path
)
|
|
Set the path where the font file .afm are located. The Postscript module require Notice: if the ps module is not created, the class store the information until it will be created and then set the given path.
The ps extension should take the path from the function set_pathname, but on my system it doesn't work (ps 1.3.0 + pslib 0.2.5). So I must provide here the full pathname (absolute or relative) to the font file as parameter to CreateFont()
Parameters:
API Tags:
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:
Redefinition of:
- APrint::SetMargin()
- Useful function to setup all margins with one function use -1 to skip the parameter
void SetPageSize(
[string
$PageType = 'A4'], mixed
$orientation
)
|
|
The page size. This function accept the well known page forms
LEGAL,LETTER, A3,A4,A5, B4, B5
Parameters:
API Tags:
void SetPrinter(
string
$Name
)
|
|
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.
Parameters:
string |
$Name: |
printer name as defined in Window |
API Tags:
Redefinition of:
- APrint::SetPrinter()
- Specifiy which printer I'll use. If you don't give any printer, the default printer will be used.
void SetTopMargin(
integer
$value
)
|
|
Set the size for the top margin
Parameters:
API Tags:
Redefinition of:
- APrint::SetTopMargin()
- Set the size for the top margin
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. If set to -1 or not provided, it use the last used font. |
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:
Redefinition of:
- APrint::Text()
- printout the text
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:
Redefinition of:
- APrint::TextFooter()
- Print the given text as page footer
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:
Redefinition of:
- APrint::TextXY()
- printout the text at the exact position requested
void _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.
API Tags:
Redefinition of:
- APrint::_CheckMarginValue()
- Check the value for the margin. They should be >0 and less then the page size
The Aprint module take the page size from the printer. Here the user must provide the
page size Unit used: twip, - inch = 1440 twip
- mm = 56.7 twip
API Tags:
Redefinition of:
- APrint::_DefinePageSize()
- inizialize all parameter about the page size Require a printer handler.
Printout page number and script name as footer
API Tags:
Redefinition of:
- APrint::_FooterNote()
- Printout page number and script name as footer
Open the output printer (APrint) or the output file (PSPrint)
API Tags:
Redefinition of:
- APrint::_OpenPrinter()
- Establish the connection to the printer
void _SetFont(
[int
$fnt = -1]
)
|
|
Activate the specified font
Parameters:
int |
$fnt: |
font handle returned by CreateFont |
API Tags:
Redefinition of:
- APrint::_SetFont()
- Activate the specified font
integer _VPoint(
integer
$PosY
)
|
|
The ps module set the point zero to the bottom edge of the page, the module has its point zero on the top edge, the function converts the vertical value from both systems.
Parameters:
integer |
$PosY: |
Vertical position (Aprint system) |
API Tags:
Return: | Vertical position (Ps system) |
Access: | private |
|
|