| Package | org.alivepdf.pdf |
| Class | public final class PDF |
| Implements | flash.events.IEventDispatcher |
| Method | Defined by | ||
|---|---|---|---|
|
PDF(pOrientation:String = "Portrait", pUnit:String = "Mm", pageSize:Object = null)
The PDF class represents a PDF document.
| |||
|
addBookmark(pText:String, pLevel:int = 0, pY:Number = 0, pRed:Number = 0, pGreen:Number = 0, pBlue:Number = 0):void
Lets you add a bookmark
| |||
|
addCell(pWidth:Number = 0, pHeight:Number = 0, pText:String = "", pBorder:Number = 0, pLn:String = "0", pAlign:Number, pFill:String = "0", pLink:*):void
Add a cell with some text to the current page
| |||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
| |||
|
addImage(pDisplayObject:DisplayObject, pAlpha:Number = 1, pBlend:String = "Normal", pMatrix:Matrix = null, pResizePage:Boolean = false, pEncoding:String = "JPG", pQuality:Number = 100, pX:Number = 0, pY:Number = 0, pWidth:Number = 0, pHeight:Number = 0, pLink:String = ""):void
The addImage method takes an incoming DisplayObject object, take a snapshot from it in JPG and add it to the PDF document
| |||
|
addLink(pX:Number, pY:Number, pWidth:Number, pHeight:Number, pLink:String, pHighlight:* = I):void
Lets you add clickable link at a specific position
| |||
|
addMultiCell(pWidth:Number, pHeight:Number, pText:String, pBorder:String = "0", pAlign:int = J, pFill:* = 0):void
Add a multicell with some text to the current page
| |||
|
addPage(pOrientation:String = "", pUnit:String = "Mm", pSize:Object = null, pRotation:Number = 0):void
Lets you add a page to the current PDF
| |||
|
addText(pTxt:String, pX:Number = 0, pY:Number = 0):void
Lets you set some text to any position on the page
| |||
|
addTextNote(pX:Number, pY:Number, pWidth:Number, pHeight:Number, pText:String = "A note !"):void
Lets you add a text annotation to the current page
| |||
|
addTransition(pStyle:String = "R", pDuration:Number = 1, pDimension:String = "H", pMotionDirection:String = "I", pTransitionDirection:int = 0):void
Lets you add a transition between each PDF page
| |||
|
aliasNbPagesMethodMethod(alias:String = "{nb}"):void
Lets you rotate a specific page (between 1 and last one)
| |||
|
Sets the filling color for differents color spaces CMYK/RGB/DEVICEGRAY
| |||
|
curveTo(pControlX1:Number, pControlY1:Number, pControlX2:Number, pControlY2:Number, pFinalX3:Number, pFinalY3:Number):void
The curveTo method draws a cubic bezier curve
| |||
|
dispatchEvent(event:Event):Boolean
| |||
|
drawCircle(pX:Number, pY:Number, pRadius:Number):void
The drawCircle method draws a circle
| |||
|
drawEllipse(pX:Number, pY:Number, pRx:Number, pRy:Number):void
The drawEllipse method draws an ellipse
| |||
|
drawPolygone(pPoints:Array):void
The drawPolygone method draws a polygone
| |||
|
drawRect(pRect:Rectangle):void
The drawRect method draws a rectangle shape
| |||
|
drawRoundRect(pRect:Rectangle, pR:*):void
The drawRoundedRect method draws a rounded rectangle shape
| |||
|
end():void
The end method closes the stroke
| |||
|
endFill():void
Ends all previous filling
| |||
|
getCurrentPage():Page
Lets you retrieve the current Page
| |||
|
getMargins():Rectangle
Lets you retrieve the margins dimensions
| |||
|
getPage(pPage:int):Page
Lets you retrieve a Page object
| |||
|
getPageCount():int
Lets you retrieve the number of pages in the PDF document
| |||
|
getX():Number
Lets you retrieve the X position for the current page
| |||
|
getY():Number
Lets you retrieve the Y position for the current page
| |||
|
hasEventListener(type:String):Boolean
| |||
|
lineStyle(pColor:Color, pThickness:Number = 1, pAlpha:Number = 1.0, pBlend:String = "Normal", pStyle:DashedLine = null, pCaps:String = null, pJoints:String = null, pMiterLimit:Number = 3, pMatrix:Matrix = null):void
Sets the stroke style
| |||
|
lineTo(pX:Number, pY:Number):void
Lets you draw a stroke from the current point to the new point
| |||
|
moveTo(pX:Number, pY:Number):void
Lets you move the current drawing point to the specified destination
| |||
|
newLine(pHeight:*):void
Lets you insert a line break for text
| |||
|
removeAllPages():void
Lets you remove all the pages from the PDF
| |||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
| |||
|
removePage(pPage:int):Page
Lets you remove a Page from the PDF
| |||
|
rotatePage(pPage:int, pRotation:Number):void
Lets you rotate a specific page (between 1 and last one)
| |||
|
savePDF(pMethod:String, pURL:String = "", pDownload:String = "inline", pName:String = "generated.pdf"):*
Lets you finalize and save the PDF document and make it available for download
| |||
|
setAlpha(pAlpha:Number, pBlendMode:String = "Normal"):void
Lets you move the current drawing point to the specified destination
| |||
|
setAuthor(pAuthor:String):void
Sets the specified author for the PDF tags
| |||
|
setBottomMargin(pMargin:Number):void
Lets you specify the bottom margin
| |||
|
setCreator(pCreator:String):void
Sets the specified creator for the PDF tags
| |||
|
setDisplayMode(pZoom:String = "FullWidth", pLayout:String = "SinglePage", pPageMode:String = "UseNone"):void
Lets you set a specific display mode, the DisplayMode takes care of the general layout of the PDF in Acrobat Reader
| |||
|
setFont(pFamily:String, pStyle:String = "", pSize:int = 0):void
Lets you set a specific font
| |||
|
setFontSize(size:int):void
Lets you retrieve a Page object
| |||
|
setKeywords(pKeywords:String):void
Sets the specified keywords for the PDF tags
| |||
|
setLeftMargin(pMargin:Number):void
Lets you specify the left margin
| |||
|
setMargins(pLeft:Number, pTop:Number, pRight:Number = -1, pBottom:Number = 20):void
Lets you specify the left, top, and right margins
| |||
|
setPagination(pActive:Boolean):void
Lets you activate the auto pagination mode
| |||
|
setRightMargin(pMargin:Number):void
Lets you specify the right margin
| |||
|
setSubject(pSubject:String):void
Lets you set a subject for the PDF tags
| |||
|
setTitle(pTitle:String):void
Lets you set a subject for the PDF tags
| |||
|
setTopMargin(pMargin:Number):void
Lets you specify the top margin
| |||
|
setViewerPreferences(pToolBar:String = "false", pMenuBar:String = "false", pWindowUI:String = "false", pFitWindow:String = "false", pCenteredWindow:String = "false", pDisplayTitle:String = "false"):void
Lets you control the way the document is to be presented on the screen or in print.
| |||
|
setX(pX:Number):void
Lets you specify the X position for the current page
| |||
|
setXY(pX:Number, pY:Number):void
Lets you specify the X and Y position for the current page
| |||
|
setY(pY:Number):void
Lets you specify the Y position for the current page
| |||
|
textStyle(pColor:Color, pAlpha:int = 1, pRendering:int = 0, pWordSpace:Number = 0, pCharSpace:Number = 0, pScale:Number = 100, pLeading:Number = 0):void
Sets the text style
| |||
|
willTrigger(type:String):Boolean
| |||
|
writeText(pHeight:Number, pText:String, pLink:String = ""):void
Lets you write some text
| |||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when PDF is generated. | ||||
| () | constructor |
public function PDF(pOrientation:String = "Portrait", pUnit:String = "Mm", pageSize:Object = null)The PDF class represents a PDF document.
ParameterspOrientation:String (default = "Portrait") |
|
pUnit:String (default = "Mm") |
|
pageSize:Object (default = null) |
var myPDF:PDF = new PDF ( Orientation.PORTRAIT, Unit.MM, Size.A4 );
| addBookmark | () | method |
public function addBookmark(pText:String, pLevel:int = 0, pY:Number = 0, pRed:Number = 0, pGreen:Number = 0, pBlue:Number = 0):voidLets you add a bookmark
ParameterspText:String — Text appearing in the outline panel
|
|
pLevel:int (default = 0) — Specify the bookmark's level
|
|
pY:Number (default = 0) — Position in the current page to go
|
|
pRed:Number (default = 0) — Red offset for the text color
|
|
pGreen:Number (default = 0) — Green offset for the text color
|
|
pBlue:Number (default = 0) — Blue offset for the text color
|
myPDF.addBookmark("A bookmark", 0, 0, 0, .9, 0);
myPDF.addPage();
myPDF.addBookmark("Another bookmark", 0, 60, .9, .9, 0);
| addCell | () | method |
public function addCell(pWidth:Number = 0, pHeight:Number = 0, pText:String = "", pBorder:Number = 0, pLn:String = "0", pAlign:Number, pFill:String = "0", pLink:*):voidAdd a cell with some text to the current page
ParameterspWidth:Number (default = 0) — Cell width
|
|
pHeight:Number (default = 0) — Cell height
|
|
pText:String (default = "") — Text to add into the cell
|
|
pBorder:Number (default = 0) — Sets the new position after cell is drawn, default value is 0
|
|
pLn:String (default = "0") — Lets you center or align the text into the cell
|
|
pAlign:Number — Lets you specify if the cell is colored (1) or transparent (0)
|
|
pFill:String (default = "0") — Any http link, like http://www.mylink.com
|
|
pLink:* |
myPDF.setFont(FontFamily.HELVETICA, 'B', 12);
myPDF.textStyle ( new RGBColor ( 255, 0, 0 ) );
myPDF.addCell(50,10,'Some text into a cell !',1,1);
myPDF.setFont(FontFamily.HELVETICA, 'B', 12);
myPDF.textStyle ( new RGBColor ( 200, 50, 50 ) );
myPDF.addCell(50,10,'A clikable cell !',1,1, null, 0, "http://www.alivepdf.org");
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| addImage | () | method |
public function addImage(pDisplayObject:DisplayObject, pAlpha:Number = 1, pBlend:String = "Normal", pMatrix:Matrix = null, pResizePage:Boolean = false, pEncoding:String = "JPG", pQuality:Number = 100, pX:Number = 0, pY:Number = 0, pWidth:Number = 0, pHeight:Number = 0, pLink:String = ""):voidThe addImage method takes an incoming DisplayObject object, take a snapshot from it in JPG and add it to the PDF document
ParameterspDisplayObject:DisplayObject — Any DisplayObject
|
|
pAlpha:Number (default = 1) — Image transparency
|
|
pBlend:String (default = "Normal") — Blend mode, can be Blend.DIFFERENCE, BLEND.HARDLIGHT, etc.
|
|
pMatrix:Matrix (default = null) — A transformation matrix to apply to the picture
|
|
pResizePage:Boolean (default = false) — Automatically resize the page so that the full picture fits in the page
|
|
pEncoding:String (default = "JPG") — Image format, can be ImageFormat.JPG
|
|
pQuality:Number (default = 100) — Compression quality
|
|
pX:Number (default = 0) — Image X position
|
|
pY:Number (default = 0) — Image Y position
|
|
pWidth:Number (default = 0) — Image width
|
|
pHeight:Number (default = 0) — Image height
|
|
pLink:String (default = "") — If pLink is specified, the image is clickable and reaches the http link specified when clicked
|
myPDF.addImage (myDisplayObject, 1 , null, null, false, ImageFormat.JPG, 100, 160, 120, 0, 0);
| addLink | () | method |
public function addLink(pX:Number, pY:Number, pWidth:Number, pHeight:Number, pLink:String, pHighlight:* = I):voidLets you add clickable link at a specific position
ParameterspX:Number — Page Format, can be Size.A3, Size.A4, Size.A5, Size.LETTER or Size.LEGAL
|
|
pY:Number |
|
pWidth:Number |
|
pHeight:Number |
|
pLink:String |
|
pHighlight:* (default = I) |
myPDF.addLink ( 70, 4, 60, 16, "http://www.alivepdf.org");
| addMultiCell | () | method |
public function addMultiCell(pWidth:Number, pHeight:Number, pText:String, pBorder:String = "0", pAlign:int = J, pFill:* = 0):voidAdd a multicell with some text to the current page
ParameterspWidth:Number — Cell width
|
|
pHeight:Number — Cell height
|
|
pText:String — Text to add into the cell
|
|
pBorder:String (default = "0") — Lets you specify if a border should be drawn around the cell
|
|
pAlign:int (default = J) — Lets you center or align the text into the cell, values can be L (left align), C (centered), R (right align), J (justified) default value
|
|
pFill:* (default = 0) — Lets you specify if the cell is colored (1) or transparent (0)
|
myPDF.setFont('helvetica', 'B', 12);
myPDF.textStyle ( new RGBColor ( 0, 0, 0 ) );
myPDF.addMultiCell ( 70, 24, "A multicell :)", 1);
myPDF.addMultiCell ( 70, 24, "A multicell :)", 1);
| addPage | () | method |
public function addPage(pOrientation:String = "", pUnit:String = "Mm", pSize:Object = null, pRotation:Number = 0):voidLets you add a page to the current PDF
ParameterspOrientation:String (default = "") — Page orientation can be Orientation.PORTRAIT or Orientation.LANDSCAPE
|
|
pUnit:String (default = "Mm") — Page Unit, can be Unit.MM, Unit.CM, Unit.POINT, Unit.INCHES
|
|
pSize:Object (default = null) — Format, can be a custom Size object, or any of the following : Size.A3, Size.A4, Size.A5, Size.LETTER, Size.LEGAL
|
|
pRotation:Number (default = 0) — Page rotation (must be a multiple of 90)
|
myPDF.addPage( Size.A4, 0, Orientation.LANDSCAPE );
myPDF.addPage( Orientation.LANDSCAPE, Unit.MM, new Size ([500, 500], "myFavoriteSize", [11.7, 16.5],[297, 420] ));
| addText | () | method |
public function addText(pTxt:String, pX:Number = 0, pY:Number = 0):voidLets you set some text to any position on the page
ParameterspTxt:String — The text to add
|
|
pX:Number (default = 0) — X position
|
|
pY:Number (default = 0) — Y position
|
myPDF.addText ('Cubic Bezier curve with curveTo', 14, 110);
| addTextNote | () | method |
public function addTextNote(pX:Number, pY:Number, pWidth:Number, pHeight:Number, pText:String = "A note !"):voidLets you add a text annotation to the current page
ParameterspX:Number — Note X position
|
|
pY:Number — Note Y position
|
|
pWidth:Number — Note width
|
|
pHeight:Number — Note height
|
|
pText:String (default = "A note !") — Text for the note
|
myPDF.addNote (100, 75, 50, 50, "A note !");
| addTransition | () | method |
public function addTransition(pStyle:String = "R", pDuration:Number = 1, pDimension:String = "H", pMotionDirection:String = "I", pTransitionDirection:int = 0):voidLets you add a transition between each PDF page
ParameterspStyle:String (default = "R") — Transition style, can be Transition.SPLIT, Transition.BLINDS, BLINDS.BOX, Transition.WIPE, etc.
|
|
pDuration:Number (default = 1) — The transition duration
|
|
pDimension:String (default = "H") — The dimension in which the the specified transition effect occurs
|
|
pMotionDirection:String (default = "I") — The motion's direction for the specified transition effect
|
|
pTransitionDirection:int (default = 0) — The direction in which the specified transition effect moves
|
myPDF.addPage();
myPDF.addTransition (Transition.WIPE, 4, Dimension.VERTICAL);
myPDF.addPage();
| aliasNbPagesMethodMethod | () | method |
public function aliasNbPagesMethodMethod(alias:String = "{nb}"):voidLets you rotate a specific page (between 1 and last one)
Parametersalias:String (default = "{nb}") — Page number
|
myPDF.rotatePage ( 1, 90 );
| beginFill | () | method |
public function beginFill(pColor:Color):voidSets the filling color for differents color spaces CMYK/RGB/DEVICEGRAY
ParameterspColor:Color — Color object, can be CMYKColor, GrayColor, or RGBColor
|
myPDF.beginFill ( new RGBColor ( 255, 0, 0 ) );
myPDF.drawRect ( new Rectangle ( 10, 26, 50, 25 ) );
| curveTo | () | method |
public function curveTo(pControlX1:Number, pControlY1:Number, pControlX2:Number, pControlY2:Number, pFinalX3:Number, pFinalY3:Number):voidThe curveTo method draws a cubic bezier curve
ParameterspControlX1:Number |
|
pControlY1:Number |
|
pControlX2:Number |
|
pControlY2:Number |
|
pFinalX3:Number |
|
pFinalY3:Number |
yPDF.lineStyle ( new RGBColor ( 255, 0, 255 ), 1, 1, null, CapsStyle.NONE, JointStyle.MITER);
myPDF.moveTo ( 10, 200 );
myPDF.curveTo ( 120, 210, 196, 280, 139, 195 );
myPDF.curveTo ( 190, 110, 206, 190, 179, 205 );
myPDF.end();
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanParameters
event:Event |
Boolean |
| drawCircle | () | method |
public function drawCircle(pX:Number, pY:Number, pRadius:Number):voidThe drawCircle method draws a circle
ParameterspX:Number — X Position
|
|
pY:Number — Y Position
|
|
pRadius:Number — Circle Radius
|
myPDF.beginFill ( new RGBColor ( 0, 0, 255 ) );
myPDF.drawCircle( 30, 180, 20 );
| drawEllipse | () | method |
public function drawEllipse(pX:Number, pY:Number, pRx:Number, pRy:Number):voidThe drawEllipse method draws an ellipse
ParameterspX:Number — X Position
|
|
pY:Number — Y Position
|
|
pRx:Number — X Radius
|
|
pRy:Number — Y Radius
|
myPDF.lineStyle ( new RGBColor ( 255, 255, 255 ), 1, .3, new DashedLine ([0, 1, 2, 6]), CapsStyle.NONE, JointStyle.ROUND);
myPDF.beginFill ( new RGBColor ( 150, 0, 0 ) );
myPDF.drawEllipse( 45, 275, 40, 15 );
| drawPolygone | () | method |
public function drawPolygone(pPoints:Array):voidThe drawPolygone method draws a polygone
ParameterspPoints:Array — Array of points
|
myPDF.beginFill ( new RGBColor ( 255, 255, 255 ) );
myPDF.drawPolygone( [10, 30, 100, 5, 80, 18] );
| drawRect | () | method |
public function drawRect(pRect:Rectangle):voidThe drawRect method draws a rectangle shape
ParameterspRect:Rectangle — A flash.geom.Rectange object
|
myPDF.lineStyle ( new RGBColor ( 255, 255, 255 ), 1, .3, null, CapsStyle.ROUND, JointStyle.MITER);
myPDF.beginFill ( new RGBColor ( 0, 0, 190 ) );
myPDF.drawRect ( new Rectangle ( 20, 46, 100, 45 ) );
| drawRoundRect | () | method |
public function drawRoundRect(pRect:Rectangle, pR:*):voidThe drawRoundedRect method draws a rounded rectangle shape
ParameterspRect:Rectangle — A flash.geom.Rectange object
|
|
pR:* — Angle radius
|
myPDF.lineStyle ( new RGBColor ( 255, 0, 0 ), 1, .3, null, CapsStyle.ROUND, JointStyle.MITER);
myPDF.beginFill ( new RGBColor ( 0, 190, 0 ) );
myPDF.drawRoundedRect ( new Rectangle ( 20, 46, 100, 45 ), 20 );
| end | () | method |
public function end():voidThe end method closes the stroke
myPDF.lineStyle( new RGBColor ( 255, 200, 0), 1, 1 );
myPDF.moveTo ( 10, 20 );
myPDF.lineTo ( 40, 20 );
myPDF.lineTo ( 40, 40 );
myPDF.lineTo ( 10, 40 );
myPDF.lineTo ( 10, 20 );
// end the stroke
myPDF.end();
| endFill | () | method |
public function endFill():voidEnds all previous filling
myPDF.beginFill ( new RGBColor ( 0, 255, 255 ) );
myPDF.moveTo ( 10, 10 );
myPDF.lineTo ( 20, 90 );
myPDF.lineTo ( 90, 50);
myPDF.end()
myPDF.endFill();
| getCurrentPage | () | method |
public function getCurrentPage():PageLets you retrieve the current Page
ReturnsPage — Page A Page object
|
myPDF.getCurrentPage ();
| getMargins | () | method |
public function getMargins():RectangleLets you retrieve the margins dimensions
ReturnsRectangle — Rectangle
|
var marginsDimensions:Rectangle = myPDF.getMargins ();
// output : (x=10.001249999999999, y=10.001249999999999, w=575.2774999999999, h=811.88875)
trace( marginsDimensions )
| getPage | () | method |
public function getPage(pPage:int):PageLets you retrieve a Page object
ParameterspPage:int — page number, from 1 to total numbers of pages
|
Page — Page
|
myPDF.getPage ( 1 );
| getPageCount | () | method |
public function getPageCount():intLets you retrieve the number of pages in the PDF document
Returnsint — int Number of pages in the PDF
|
var totalPages:int = myPDF.getPageCount ();
| getX | () | method |
public function getX():NumberLets you retrieve the X position for the current page
ReturnsNumber — Number the X position
|
| getY | () | method |
public function getY():NumberLets you retrieve the Y position for the current page
ReturnsNumber — Number the Y position
|
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanParameters
type:String |
Boolean |
| lineStyle | () | method |
public function lineStyle(pColor:Color, pThickness:Number = 1, pAlpha:Number = 1.0, pBlend:String = "Normal", pStyle:DashedLine = null, pCaps:String = null, pJoints:String = null, pMiterLimit:Number = 3, pMatrix:Matrix = null):voidSets the stroke style
ParameterspColor:Color — Color object, can be CMYKColor, GrayColor, or RGBColor
|
|
pThickness:Number (default = 1) |
|
pAlpha:Number (default = 1.0) |
|
pBlend:String (default = "Normal") |
|
pStyle:DashedLine (default = null) |
|
pCaps:String (default = null) |
|
pJoints:String (default = null) |
|
pMiterLimit:Number (default = 3) |
|
pMatrix:Matrix (default = null) |
myPDF.lineStyle ( new RGBColor ( 150, 250, 0 ), 1, 1, null, Caps.NONE, Joint.MITER);
| lineTo | () | method |
public function lineTo(pX:Number, pY:Number):voidLets you draw a stroke from the current point to the new point
ParameterspX:Number — X position
|
|
pY:Number — Y position
|
myPDF.lineStyle( new RGBColor ( 255, 200, 0), 1, 1 );
myPDF.moveTo ( 10, 20 );
myPDF.lineTo ( 40, 20 );
myPDF.lineTo ( 40, 40 );
myPDF.lineTo ( 10, 40 );
myPDF.lineTo ( 10, 20 );
myPDF.end();
| moveTo | () | method |
public function moveTo(pX:Number, pY:Number):voidLets you move the current drawing point to the specified destination
ParameterspX:Number — X position
|
|
pY:Number — Y position
|
myPDF.moveTo ( 120, 200 );
| newLine | () | method |
public function newLine(pHeight:*):voidLets you insert a line break for text
ParameterspHeight:* — Line break height
|
myPDF.newLine ( 10 );
| removeAllPages | () | method |
public function removeAllPages():voidLets you remove all the pages from the PDF
myPDF.removeAllPages();
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
| removePage | () | method |
public function removePage(pPage:int):PageLets you remove a Page from the PDF
ParameterspPage:int — page number, from 1 to total numbers of pages
|
Page — Page
|
myPDF.removePage(1);If you want to remove pages each by each, you can combine removePage with getPageCount
myPDF.removePage(myPDFEncoder.getPageCount());
| rotatePage | () | method |
public function rotatePage(pPage:int, pRotation:Number):voidLets you rotate a specific page (between 1 and last one)
ParameterspPage:int — Page number
|
|
pRotation:Number — Page rotation (must be a multiple of 90)
|
— |
myPDF.rotatePage ( 1, 90 );
| savePDF | () | method |
public function savePDF(pMethod:String, pURL:String = "", pDownload:String = "inline", pName:String = "generated.pdf"):*Lets you finalize and save the PDF document and make it available for download
ParameterspMethod:String — Can be se to Method.LOCAL, the savePDF will return the PDF ByteArray. When Method.REMOTE is passed, just specify the path to the create.php file
|
|
pURL:String (default = "") — The url of the create.php file
|
|
pDownload:String (default = "inline") — Lets you specify the way the PDF is going to be available. Use Download.INLINE if you want the PDF to be opened in the browser, use Download.ATTACHMENT if you want to make it available with a save-as dialog box
|
|
pName:String (default = "generated.pdf") — The name of the PDF, only available when Method.REMOTE is used
|
* — The ByteArray PDF when Method.LOCAL is used, otherwise the method returns null
|
var myPDFStream:ByteArray = myPDF.getPDF();
| setAlpha | () | method |
public function setAlpha(pAlpha:Number, pBlendMode:String = "Normal"):voidLets you move the current drawing point to the specified destination
ParameterspAlpha:Number — Opacity
|
|
pBlendMode:String (default = "Normal") — Blend mode, can be Blend.DIFFERENCE, BLEND.HARDLIGHT, etc.
|
myPDF.setAlpha ( .5 );
| setAuthor | () | method |
public function setAuthor(pAuthor:String):voidSets the specified author for the PDF tags
ParameterspAuthor:String — The author
|
myPDF.setAuthor ( "Bob" );
| setBottomMargin | () | method |
public function setBottomMargin(pMargin:Number):voidLets you specify the bottom margin
ParameterspMargin:Number — Bottom margin
|
myPDF.setBottomMargin ( 10 );
| setCreator | () | method |
public function setCreator(pCreator:String):voidSets the specified creator for the PDF tags
ParameterspCreator:String — Page number
|
myPDF.rotatePage ( 1, 90 );
| setDisplayMode | () | method |
public function setDisplayMode(pZoom:String = "FullWidth", pLayout:String = "SinglePage", pPageMode:String = "UseNone"):voidLets you set a specific display mode, the DisplayMode takes care of the general layout of the PDF in Acrobat Reader
ParameterspZoom:String (default = "FullWidth") — Zoom mode, can be Display.FULL_PAGE, Display.FULL_WIDTH, Display.REAL, Display.DEFAULT
|
|
pLayout:String (default = "SinglePage") — Layout of the PDF document, can be Layout.SINGLE_PAGE, Layout.ONE_COLUMN, Layout.TWO_COLUMN_LEFT, Layout.TWO_COLUMN_RIGHT
|
|
pPageMode:String (default = "UseNone") — PageMode can be pageMode.USE_NONE, PageMode.USE_OUTLINES, PageMode.USE_THUMBS, PageMode.FULL_SCREEN
|
myPDF.setDisplayMode (Display.FULL_PAGE, Layout.SINGLE_PAGE);
| setFont | () | method |
public function setFont(pFamily:String, pStyle:String = "", pSize:int = 0):voidLets you set a specific font
ParameterspFamily:String — Font family, can be any of FontFamily.COURIER, FontFamily.HELVETICA, FontFamily.ARIAL, FontFamily.TIMES, FontFamily.SYMBOL, FontFamily.ZAPFDINGBATS.
|
|
pStyle:String (default = "") — Any font style, can be Style.BOLD, Style.ITALIC, Style.BOLD_ITALIC, Style.NORMAL
|
|
pSize:int (default = 0) |
myPDF.setFont( FontFamily.HELVETICA, Style.BOLD );
| setFontSize | () | method |
public function setFontSize(size:int):voidLets you retrieve a Page object
Parameterssize:int — Page Format, can be Size.A3, Size.A4, Size.A5, Size.LETTER or Size.LEGAL
|
myPDF.getPage ( 1 );
| setKeywords | () | method |
public function setKeywords(pKeywords:String):voidSets the specified keywords for the PDF tags
ParameterspKeywords:String — The keywords
|
myPDF.setKeywords ( "Design, Agency, Communication, etc." );
| setLeftMargin | () | method |
public function setLeftMargin(pMargin:Number):voidLets you specify the left margin
ParameterspMargin:Number — Left margin
|
myPDF.setLeftMargin ( 10 );
| setMargins | () | method |
public function setMargins(pLeft:Number, pTop:Number, pRight:Number = -1, pBottom:Number = 20):voidLets you specify the left, top, and right margins
ParameterspLeft:Number — Left margin
|
|
pTop:Number — Right number
|
|
pRight:Number (default = -1) — Top number
|
|
pBottom:Number (default = 20) |
myPDF.setMargins ( 10, 10, 10 );
| setPagination | () | method |
public function setPagination(pActive:Boolean):voidLets you activate the auto pagination mode
ParameterspActive:Boolean — Activate the mode
|
myPDF.setPagination ( true );
| setRightMargin | () | method |
public function setRightMargin(pMargin:Number):voidLets you specify the right margin
ParameterspMargin:Number — Right margin
|
myPDF.setRightMargin ( 10 );
| setSubject | () | method |
public function setSubject(pSubject:String):voidLets you set a subject for the PDF tags
ParameterspSubject:String — The subject
|
myPDF.setSubject ( "Any topic" );
| setTitle | () | method |
public function setTitle(pTitle:String):voidLets you set a subject for the PDF tags
ParameterspTitle:String — The title
|
myPDF.setTitle ( "AlivePDF !" );
| setTopMargin | () | method |
public function setTopMargin(pMargin:Number):voidLets you specify the top margin
ParameterspMargin:Number — Top margin
|
myPDF.setTopMargin ( 10 );
| setViewerPreferences | () | method |
public function setViewerPreferences(pToolBar:String = "false", pMenuBar:String = "false", pWindowUI:String = "false", pFitWindow:String = "false", pCenteredWindow:String = "false", pDisplayTitle:String = "false"):voidLets you control the way the document is to be presented on the screen or in print.
ParameterspToolBar:String (default = "false") — Toolbar behavior
|
|
pMenuBar:String (default = "false") — Menubar behavior
|
|
pWindowUI:String (default = "false") — WindowUI behavior
|
|
pFitWindow:String (default = "false") — Specify whether to resize the document's window to fit the size of the first displayed page.
|
|
pCenteredWindow:String (default = "false") — Specify whether to position the document's window in the center of the screen.
|
|
pDisplayTitle:String (default = "false") — Specify whether the window's title bar should display the document title taken from the value passed to the setTitle method
|
myPDF.setViewerPreferences (ToolBar.HIDE, MenuBar.HIDE, WindowUI.HIDE, FitWindow.DEFAULT, CenterWindow.CENTERED);
| setX | () | method |
public function setX(pX:Number):voidLets you specify the X position for the current page
ParameterspX:Number — the X position
|
| setXY | () | method |
public function setXY(pX:Number, pY:Number):voidLets you specify the X and Y position for the current page
ParameterspX:Number — The X position
|
|
pY:Number — The Y position
|
| setY | () | method |
public function setY(pY:Number):voidLets you specify the Y position for the current page
ParameterspY:Number — the Y position
|
| textStyle | () | method |
public function textStyle(pColor:Color, pAlpha:int = 1, pRendering:int = 0, pWordSpace:Number = 0, pCharSpace:Number = 0, pScale:Number = 100, pLeading:Number = 0):voidSets the text style
ParameterspColor:Color — Color object, can be CMYKColor, GrayColor, or RGBColor
|
|
pAlpha:int (default = 1) — Text opacity
|
|
pRendering:int (default = 0) — pRendering Specify the text rendering mode
|
|
pWordSpace:Number (default = 0) — Spaces between each words
|
|
pCharSpace:Number (default = 0) — Spaces between each characters
|
|
pScale:Number (default = 100) — Text scaling
|
|
pLeading:Number (default = 0) — Text leading
|
myPDF.textStyle ( new RGBColor ( 0, 0, 0 ), 1 );
| willTrigger | () | method |
public function willTrigger(type:String):BooleanParameters
type:String |
Boolean |
| writeText | () | method |
public function writeText(pHeight:Number, pText:String, pLink:String = ""):voidLets you write some text
ParameterspHeight:Number — Line height, lets you specify height between each lines
|
|
pText:String — Text to write, to put a line break just add a \n in the text string
|
|
pLink:String (default = "") — Any link, like http://www.mylink.com, will open te browser when clicked
|
myPDF.writeText ( 5, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", "http://www.google.fr");
myPDF.writeText ( 5, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", "http://www.google.fr");
| complete | event |
flash.events.Event.COMPLETE
Dispatched when PDF is generated. The finish() method generate this event
myPDF.addEventListener ( Event.COMPLETE, generated );