Script: PRINT_CLASS

Author: Valentin Schmidt
Version: 0.2
Created: 19.06.2009
Modified: 22.07.2009

Description

This script implements printing based on flash.

Usage:

p = script("PRINT_CLASS").new()
p.mAddPage()
p.mAddText("Hello World!", 50, 50, 100) 
p.mPrint()
p.mDestroy()
p=0

History

v0.1 First version

v0.2 Minor bug fix

Dependencies

Public Interface

Methods Description

new

new (me, tFlashSprite, tPageFormat, tOrientation)

Parameters

Description

Constructor

mDestroy

mDestroy (me)

Description

Safely deletes object, releases memory

mSetMargins

mSetMargins (me, tMargins)

Parameters

Description

Sets page marginsmargins are specified as floats

mSetAutoPageBreak

mSetAutoPageBreak (me, tBool)

Parameters

Description

(De)Activates autoPageBreak

mAddPage

mAddPage (me)

Description

Adds a new page to the document

mSetActivePage

mSetActivePage (me, tPageNum)

Parameters

Description

Changes the active page

mAddText

mAddText (me, tText, tX, tY, tW, tH, tSettings, tFormat)

Parameters

Returns

{float}: y-position of text bottom

Description

Adds a text to the document at the specified position

mGetTextWidth

mGetTextWidth (me, tText, tSettings, tFormat)

Parameters

Returns

{float}

Description

Returns width of string when printed with current/specified format

See also

mAddText

mAddImage

mAddImage (me, tImage, tX, tY, tW, tH, tSettings)

Parameters

Description

Adds an image to the document at the specified position

mSetDrawColor

mSetDrawColor (me, tColor)

Parameters

Description

Sets the draw color

mSetFillColor

mSetFillColor (me, tColor)

Parameters

Description

Sets the fill color

mSetFillAlpha

mSetFillAlpha (me, tAlpha)

Parameters

Description

Sets the fill alpha value

mSetTextFormat

mSetTextFormat (me, tFormat)

Parameters

Description

Sets the default text format for all text

mSetTextColor

mSetTextColor (me, tColor)

Parameters

Description

Sets the text color

mSetFont

mSetFont (me, tFont)

Parameters

Description

Sets the font

mSetFontSize

mSetFontSize (me, tFontSize)

Parameters

Description

Sets the fontsize

mSetLineStyle

mSetLineStyle (me, tLineStyle)

Parameters

Description

Sets the linestyle

mAddLine

mAddLine (me, tX1, tY1, tX2, tY2, tLineGradProps)

Parameters

Description

Draws a line

mAddRect

mAddRect (me, tX, tY, tW, tH, tStyle, tLineGradProps, tFillGradProps)

Parameters

Description

Draws a rect

mAddRoundedRect

mAddRoundedRect (me, tX, tY, tW, tH, tR, tStyle, tLineGradProps, tFillGradProps)

Parameters

Description

Draws a rounded rect

mAddOval

mAddOval (me, tX, tY, tRX, tRY, tStyle, tLineGradProps, tFillGradProps)

Parameters

Description

Draws a circle or oval

mAddPoly

mAddPoly (me, tPoints, tStyle, tLineGradProps, tFillGradProps)

Parameters

Description

Draws a polygon

mAddCurve

mAddCurve (me, tPoints, tStyle, tLineGradProps, tFillGradProps)

Parameters

Description

Draws a quadratic bezier curve

mSetPagePrintAsBitmapMode

mSetPagePrintAsBitmapMode (me, tPageNum, tBool)

Parameters

Description

Explicitely sets the printMode for the specified page

mGetPreview

mGetPreview (me, tPageNum, tAddBorder)

Parameters

Returns

{image}

Description

Returns an image of the specified page (as 72 dpi)

mPrint

mPrint (me, tPrintAllPagesAsBitmap)

Parameters

Returns

{integer}: (1 or 0)

Description

Prints the current document

mHeader (me)

Description

This method is used to render the page header. It is automatically called by mAddPage() and should not be called directly by the application. The implementation in the PRINT class is empty, so you have to subclass it and override the method if you want a specific processing.

mFooter

mFooter (me)

Description

This method is used to render the page footer. It is automatically called by mAddPage() and should not be called directly by the application. The implementation in the PRINT class is empty, so you have to subclass it and override the method if you want a specific processing.