Packageorg.purepdf.pdf
Classpublic class PdfDocument
InheritancePdfDocument Inheritance flash.events.EventDispatcher
Implements it.sephiroth.utils.IObject, IElementListener

See also

org.purepdf.events.SectionEvent
org.purepdf.events.ChapterEvent
org.purepdf.events.ParagraphEvent
org.purepdf.events.PageEvent


Public Properties
 PropertyDefined By
  compress : Boolean = true
[static]
PdfDocument
  duration : int
[write-only] Sets the display duration for the page (for presentations)
PdfDocument
  isPageEmpty : Boolean
[read-only]
PdfDocument
  marginBottom : Number
[read-only]
PdfDocument
  marginLeft : Number
[read-only]
PdfDocument
  marginMirroring : Boolean
PdfDocument
  marginRight : Number
[read-only]
PdfDocument
  marginTop : Number
[read-only]
PdfDocument
  opened : Boolean
[read-only] Return true if the document is already opened
PdfDocument
  pageNumber : int
[read-only]
PdfDocument
  pageResources : PageResources
[read-only]
PdfDocument
  pageSize : RectangleElement
Return the current pagesize
PdfDocument
  transition : PdfTransition
[write-only] Set the transition for the page
PdfDocument
  userunit : Number
Use this method to set the user unit A UserUnit is a value that defines the default user space unit The minimum UserUnit is 1 (1 unit = 1/72 inch). The maximum UserUnit is 75,000. Remember that you need to set the pdf version to 1.6
PdfDocument
  writer : PdfWriter
[read-only]
PdfDocument
Protected Properties
 PropertyDefined By
  additionalActions : PdfDictionary
PdfDocument
  alignment : int = 0
PdfDocument
  anchorAction : PdfAction = null
PdfDocument
  annotationsImp : PdfAnnotationsImp
PdfDocument
  boxSize : HashMap
PdfDocument
  chapternumber : int = 0
PdfDocument
  closed : Boolean
PdfDocument
  currentHeight : Number = 0
PdfDocument
  currentOutline : PdfOutline
PdfDocument
  documentFileAttachment : HashMap
PdfDocument
  documentLevelJS : HashMap
PdfDocument
  _duration : int = -1
PdfDocument
  firstPageEvent : Boolean = true
PdfDocument
  footer : HeaderFooter = null
PdfDocument
  graphics : PdfContentByte
PdfDocument
  _hashCode : int
PdfDocument
  header : HeaderFooter = null
PdfDocument
  imageEnd : Number = -1
PdfDocument
  imageWait : ImageElement
PdfDocument
  indentation : Indentation
PdfDocument
  indentBottom : Number
[read-only]
PdfDocument
  indentLeft : Number
[read-only]
PdfDocument
  indentRight : Number
[read-only]
PdfDocument
  indentTop : Number
[read-only]
PdfDocument
  info : PdfInfo
PdfDocument
  isSectionTitle : Boolean = false
PdfDocument
  lastElementType : int = -1
PdfDocument
  leading : Number = 0
PdfDocument
  leadingCount : int = 0
PdfDocument
  line : PdfLine = null
PdfDocument
  lines : Vector.<PdfLine>
PdfDocument
  localDestinations : HashMap
PdfDocument
  _marginBottom : Number = 36.0
PdfDocument
  _marginLeft : Number = 36.0
PdfDocument
  _marginMirroring : Boolean = false
PdfDocument
  marginMirroringTopBottom : Boolean = false
PdfDocument
  _marginRight : Number = 36.0
PdfDocument
  _marginTop : Number = 36.0
PdfDocument
  markPoint : int = 0
PdfDocument
  nextMarginBottom : Number = 36.0
PdfDocument
  nextMarginLeft : Number = 36.0
PdfDocument
  nextMarginRight : Number = 36.0
PdfDocument
  nextMarginTop : Number = 36.0
PdfDocument
  _nextPageSize : RectangleElement
PdfDocument
  _opened : Boolean
PdfDocument
  pageEmpty : Boolean = true
PdfDocument
  pageLabels : PdfPageLabels
PdfDocument
  pageN : int = 0
PdfDocument
  _pageResources : PageResources
PdfDocument
  _pageSize : RectangleElement
PdfDocument
  rootOutline : PdfOutline
PdfDocument
  strictImageSequence : Boolean = false
PdfDocument
  text : PdfContentByte
PdfDocument
  textEmptySize : int
PdfDocument
  thisBoxSize : HashMap
PdfDocument
  thumb : PdfIndirectReference
PdfDocument
  _transition : PdfTransition = null
PdfDocument
  viewerPreferences : PdfViewerPreferencesImp
PdfDocument
  _writer : PdfWriter
PdfDocument
Public Methods
 MethodDefined By
  
PdfDocument
  
add(element:IElement):Boolean
Add a new element to the current pdf document
PdfDocument
  
addAdditionalAction(actionType:PdfName, action:PdfAction):void
Adds additional javascript action to the document
PdfDocument
  
PdfDocument
  
addAuthor(value:String):Boolean
PdfDocument
  
addCreationDate():Boolean
PdfDocument
  
addCreator(creator:String):Boolean
PdfDocument
  
addElement(element:IElement):Boolean
Don't use this directly if you are 100% sure what you're doing.
PdfDocument
  
addFileAttachment(description:String, file:ByteArray, fileName:String):void
Add a file attachment at the document level
PdfDocument
  
addJavaScript(code:String, unicode:Boolean = false):void
Add a JavaScript action at the document level.
PdfDocument
  
addKeywords(keywords:String):Boolean
PdfDocument
  
addProducer():Boolean
PdfDocument
  
addSubject(subject:String):Boolean
PdfDocument
  
addTitle(title:String):Boolean
PdfDocument
  
PdfDocument
  
bottom(margin:Number = 0):Number
PdfDocument
  
PdfDocument
  
close():void
Close the document
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
getVerticalPosition(ensurenewline:Boolean):Number
Gets the current vertical page position.
PdfDocument
  
hashCode():int
PdfDocument
  
left(margin:Number = 0):Number
PdfDocument
  
localDestination(name:String, destination:PdfDestination):Boolean
The local destination to where a local goto with the same name will jump to.
PdfDocument
  
localGoto(name:String, llx:Number, lly:Number, urx:Number, ury:Number):void
Implements a link to other part of the document.
PdfDocument
  
lockLayer(layer:PdfLayer):void
Use this method to lock a content group The state of a locked group can not be changed using the user interface of a viewer application
PdfDocument
  
newPage():Boolean
make a new page
PdfDocument
  
open():void
open the document
PdfDocument
  
outlineTree(outline:PdfOutline):void
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
right(margin:Number = 0):Number
PdfDocument
  
PdfDocument
  
PdfDocument
  
PdfDocument
  
setMargins(marginLeft:Number, marginRight:Number, marginTop:Number, marginBottom:Number):Boolean
PdfDocument
  
setPageLabels(pageLabels:PdfPageLabels):void
Sets the page labels
PdfDocument
  
setPdfVersion(value:String):void
PdfDocument
  
Deprecated: Deprecated
Assign a thumbnail to the current page Acrobat/Reader 9 no longer use the embedded thumbnail.
PdfDocument
  
setViewerPreferences(preferences:int):void
Set the view preferences for this document
PdfDocument
  
top(margin:Number = 0):Number
PdfDocument
  
PdfDocument
  
PdfDocument
Protected Methods
 MethodDefined By
  
addSpacing(extraspace:Number, oldleading:Number, f:Font):void
Adds extra space.
PdfDocument
  
PdfDocument
  
doFooter():void
Draw the document footer
PdfDocument
  
doHeader():void
Draw the document headers
PdfDocument
  
Ensure a new line is started
PdfDocument
  
flushLines():Number
PdfDocument
  
initPage():void
PdfDocument
  
newLine():void
Adds the current line to the list of lines and also adds an empty line.
PdfDocument
  
PdfDocument
Events
 Event Summary Defined By
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
  PdfDocument
Public Constants
 ConstantDefined By
  DID_PRINT : PdfName
[static]
PdfDocument
  DID_SAVE : PdfName
[static]
PdfDocument
  DOCUMENT_CLOSE : PdfName
[static]
PdfDocument
  hangingPunctuation : String = .,;:'
[static]
PdfDocument
  WILL_PRINT : PdfName
[static]
PdfDocument
  WILL_SAVE : PdfName
[static]
PdfDocument
  wmfFontCorrection : Number = 0.86
[static]
PdfDocument
Property Detail
_durationproperty
protected var _duration:int = -1

_hashCodeproperty 
protected var _hashCode:int

_marginBottomproperty 
protected var _marginBottom:Number = 36.0

_marginLeftproperty 
protected var _marginLeft:Number = 36.0

_marginMirroringproperty 
protected var _marginMirroring:Boolean = false

_marginRightproperty 
protected var _marginRight:Number = 36.0

_marginTopproperty 
protected var _marginTop:Number = 36.0

_nextPageSizeproperty 
protected var _nextPageSize:RectangleElement

_openedproperty 
protected var _opened:Boolean

_pageResourcesproperty 
protected var _pageResources:PageResources

_pageSizeproperty 
protected var _pageSize:RectangleElement

_transitionproperty 
protected var _transition:PdfTransition = null

_writerproperty 
protected var _writer:PdfWriter

additionalActionsproperty 
protected var additionalActions:PdfDictionary

alignmentproperty 
protected var alignment:int = 0

anchorActionproperty 
protected var anchorAction:PdfAction = null

annotationsImpproperty 
protected var annotationsImp:PdfAnnotationsImp

boxSizeproperty 
protected var boxSize:HashMap

chapternumberproperty 
protected var chapternumber:int = 0

closedproperty 
protected var closed:Boolean

compressproperty 
public static var compress:Boolean = true

currentHeightproperty 
protected var currentHeight:Number = 0

currentOutlineproperty 
protected var currentOutline:PdfOutline

documentFileAttachmentproperty 
protected var documentFileAttachment:HashMap

documentLevelJSproperty 
protected var documentLevelJS:HashMap

durationproperty 
duration:int  [write-only]

Sets the display duration for the page (for presentations)


Implementation
    public function set duration(value:int):void
firstPageEventproperty 
protected var firstPageEvent:Boolean = true

footerproperty 
protected var footer:HeaderFooter = null

graphicsproperty 
protected var graphics:PdfContentByte

headerproperty 
protected var header:HeaderFooter = null

imageEndproperty 
protected var imageEnd:Number = -1

imageWaitproperty 
protected var imageWait:ImageElement

indentationproperty 
protected var indentation:Indentation

indentBottomproperty 
indentBottom:Number  [read-only]


Implementation
    protected function get indentBottom():Number
indentLeftproperty 
indentLeft:Number  [read-only]


Implementation
    protected function get indentLeft():Number
indentRightproperty 
indentRight:Number  [read-only]


Implementation
    protected function get indentRight():Number
indentTopproperty 
indentTop:Number  [read-only]


Implementation
    protected function get indentTop():Number
infoproperty 
protected var info:PdfInfo

isPageEmptyproperty 
isPageEmpty:Boolean  [read-only]


Implementation
    public function get isPageEmpty():Boolean
isSectionTitleproperty 
protected var isSectionTitle:Boolean = false

lastElementTypeproperty 
protected var lastElementType:int = -1

leadingproperty 
protected var leading:Number = 0

leadingCountproperty 
protected var leadingCount:int = 0

lineproperty 
protected var line:PdfLine = null

linesproperty 
protected var lines:Vector.<PdfLine>

localDestinationsproperty 
protected var localDestinations:HashMap

marginBottomproperty 
marginBottom:Number  [read-only]


Implementation
    public function get marginBottom():Number
marginLeftproperty 
marginLeft:Number  [read-only]


Implementation
    public function get marginLeft():Number
marginMirroringproperty 
marginMirroring:Boolean


Implementation
    public function get marginMirroring():Boolean
    public function set marginMirroring(value:Boolean):void
marginMirroringTopBottomproperty 
protected var marginMirroringTopBottom:Boolean = false

marginRightproperty 
marginRight:Number  [read-only]


Implementation
    public function get marginRight():Number
marginTopproperty 
marginTop:Number  [read-only]


Implementation
    public function get marginTop():Number
markPointproperty 
protected var markPoint:int = 0

nextMarginBottomproperty 
protected var nextMarginBottom:Number = 36.0

nextMarginLeftproperty 
protected var nextMarginLeft:Number = 36.0

nextMarginRightproperty 
protected var nextMarginRight:Number = 36.0

nextMarginTopproperty 
protected var nextMarginTop:Number = 36.0

openedproperty 
opened:Boolean  [read-only]

Return true if the document is already opened


Implementation
    public function get opened():Boolean
pageEmptyproperty 
protected var pageEmpty:Boolean = true

pageLabelsproperty 
protected var pageLabels:PdfPageLabels

pageNproperty 
protected var pageN:int = 0

pageNumberproperty 
pageNumber:int  [read-only]


Implementation
    public function get pageNumber():int
pageResourcesproperty 
pageResources:PageResources  [read-only]


Implementation
    public function get pageResources():PageResources
pageSizeproperty 
pageSize:RectangleElement

Return the current pagesize


Implementation
    public function get pageSize():RectangleElement
    public function set pageSize(value:RectangleElement):void
rootOutlineproperty 
protected var rootOutline:PdfOutline

strictImageSequenceproperty 
protected var strictImageSequence:Boolean = false

textproperty 
protected var text:PdfContentByte

textEmptySizeproperty 
protected var textEmptySize:int

thisBoxSizeproperty 
protected var thisBoxSize:HashMap

thumbproperty 
protected var thumb:PdfIndirectReference

transitionproperty 
transition:PdfTransition  [write-only]

Set the transition for the page


Implementation
    public function set transition(value:PdfTransition):void
userunitproperty 
userunit:Number

Since : 1.6

Use this method to set the user unit

A UserUnit is a value that defines the default user space unit

The minimum UserUnit is 1 (1 unit = 1/72 inch).

The maximum UserUnit is 75,000.

Remember that you need to set the pdf version to 1.6


Implementation
    public function get userunit():Number
    public function set userunit(value:Number):void

Throws
DocumentError
viewerPreferencesproperty 
protected var viewerPreferences:PdfViewerPreferencesImp

writerproperty 
writer:PdfWriter  [read-only]


Implementation
    public function get writer():PdfWriter
Constructor Detail
PdfDocument()Constructor
public function PdfDocument(size:RectangleElement)



Parameters
size:RectangleElement
Method Detail
add()method
public function add(element:IElement):Boolean

Add a new element to the current pdf document

Parameters

element:IElement

Returns
Boolean — true if the element was succesfully added to the documnet

See also

addAdditionalAction()method 
public function addAdditionalAction(actionType:PdfName, action:PdfAction):void

Adds additional javascript action to the document

Parameters

actionType:PdfName
 
action:PdfAction

See also

addAnnotation()method 
public function addAnnotation(annot:PdfAnnotation):void

Parameters

annot:PdfAnnotation

addAuthor()method 
public function addAuthor(value:String):Boolean

Parameters

value:String

Returns
Boolean
addCreationDate()method 
public function addCreationDate():Boolean

Returns
Boolean
addCreator()method 
public function addCreator(creator:String):Boolean

Parameters

creator:String

Returns
Boolean
addElement()method 
public function addElement(element:IElement):Boolean

Don't use this directly if you are 100% sure what you're doing. Use add() instead

Parameters

element:IElement

Returns
Boolean

See also

addElement()
addFileAttachment()method 
public function addFileAttachment(description:String, file:ByteArray, fileName:String):void

Add a file attachment at the document level

Parameters

description:String — the file description
 
file:ByteArray — file contents
 
fileName:String — file name

addJavaScript()method 
public function addJavaScript(code:String, unicode:Boolean = false):void

Add a JavaScript action at the document level. When the document opens, all this JavaScript runs.

Parameters

code:String — the JavaScript code
 
unicode:Boolean (default = false) — select JavaScript unicode

addKeywords()method 
public function addKeywords(keywords:String):Boolean

Parameters

keywords:String

Returns
Boolean
addProducer()method 
public function addProducer():Boolean

Returns
Boolean
addSpacing()method 
protected function addSpacing(extraspace:Number, oldleading:Number, f:Font):void

Adds extra space. This method should probably be rewritten.

Parameters

extraspace:Number
 
oldleading:Number
 
f:Font

addSubject()method 
public function addSubject(subject:String):Boolean

Parameters

subject:String

Returns
Boolean
addTitle()method 
public function addTitle(title:String):Boolean

Parameters

title:String

Returns
Boolean
addWriter()method 
public function addWriter(w:PdfWriter):void

Parameters

w:PdfWriter

bottom()method 
public function bottom(margin:Number = 0):Number

Parameters

margin:Number (default = 0)

Returns
Number
calculateOutlineCount()method 
public function calculateOutlineCount():void

carriageReturn()method 
protected function carriageReturn():void

close()method 
public function close():void

Close the document

doFooter()method 
protected function doFooter():void

Draw the document footer


Throws
DocumentError
doHeader()method 
protected function doHeader():void

Draw the document headers


Throws
DocumentError
ensureNewLine()method 
protected function ensureNewLine():void

Ensure a new line is started

flushLines()method 
protected function flushLines():Number

Returns
Number
getCatalog()method 
public function getCatalog(pages:PdfIndirectReference):PdfCatalog

Parameters

pages:PdfIndirectReference

Returns
PdfCatalog
getCurrentPage()method 
public function getCurrentPage():PdfIndirectReference

Returns
PdfIndirectReference
getDefaultColorSpace()method 
public function getDefaultColorSpace():PdfDictionary

Returns
PdfDictionary
getDirectContent()method 
public function getDirectContent():PdfContentByte

Returns
PdfContentByte
getDirectContentUnder()method 
public function getDirectContentUnder():PdfContentByte

Returns
PdfContentByte
getInfo()method 
public function getInfo():PdfInfo

Returns
PdfInfo
getMarkPoint()method 
pdf_core function getMarkPoint():int

Returns
int
getPageReference()method 
public function getPageReference(page:int):PdfIndirectReference

Parameters

page:int

Returns
PdfIndirectReference

See also

getVerticalPosition()method 
public function getVerticalPosition(ensurenewline:Boolean):Number

Gets the current vertical page position.

Parameters

ensurenewline:Boolean — Tells whether a new line shall be enforced

Returns
Number
hashCode()method 
public function hashCode():int

Returns
int
incMarkPoint()method 
pdf_core function incMarkPoint():void

initPage()method 
protected function initPage():void

left()method 
public function left(margin:Number = 0):Number

Parameters

margin:Number (default = 0)

Returns
Number
localDestination()method 
public function localDestination(name:String, destination:PdfDestination):Boolean

The local destination to where a local goto with the same name will jump to.

Parameters

name:String — the name of this local destination
 
destination:PdfDestination — the PdfDestination with the jump coordinates

Returns
Booleantrue if the local destination was added, false if a local destination with the same name already existed
localGoto()method 
public function localGoto(name:String, llx:Number, lly:Number, urx:Number, ury:Number):void

Implements a link to other part of the document. The jump will be made to a local destination with the same name, that must exist.

Parameters

name:String — the name for this link
 
llx:Number — the lower left x corner of the activation area
 
lly:Number — the lower left y corner of the activation area
 
urx:Number — the upper right x corner of the activation area
 
ury:Number — the upper right y corner of the activation area

lockLayer()method 
public function lockLayer(layer:PdfLayer):void

Use this method to lock a content group The state of a locked group can not be changed using the user interface of a viewer application

Parameters

layer:PdfLayer

newLine()method 
protected function newLine():void

Adds the current line to the list of lines and also adds an empty line.

newPage()method 
public function newPage():Boolean

make a new page

Returns
Boolean
open()method 
public function open():void

open the document

outlineTree()method 
public function outlineTree(outline:PdfOutline):void

Parameters

outline:PdfOutline

resetFooter()method 
public function resetFooter():void

resetHeader()method 
public function resetHeader():void

resetPageCount()method 
public function resetPageCount():void

right()method 
public function right(margin:Number = 0):Number

Parameters

margin:Number (default = 0)

Returns
Number
setDefaultColorSpace()method 
public function setDefaultColorSpace(key:PdfName, value:PdfObject):void

Parameters

key:PdfName
 
value:PdfObject

setFooter()method 
public function setFooter(value:HeaderFooter):void

Parameters

value:HeaderFooter

setHeader()method 
public function setHeader(value:HeaderFooter):void

Parameters

value:HeaderFooter

setMargins()method 
public function setMargins(marginLeft:Number, marginRight:Number, marginTop:Number, marginBottom:Number):Boolean

Parameters

marginLeft:Number
 
marginRight:Number
 
marginTop:Number
 
marginBottom:Number

Returns
Boolean
setNewPageSizeAndMargins()method 
protected function setNewPageSizeAndMargins():void

setPageLabels()method 
public function setPageLabels(pageLabels:PdfPageLabels):void

Sets the page labels

Parameters

pageLabels:PdfPageLabels — the page labels

setPdfVersion()method 
public function setPdfVersion(value:String):void

Parameters

value:String

setThumbnail()method 
public function setThumbnail(image:ImageElement):void
Deprecated: Deprecated

Assign a thumbnail to the current page Acrobat/Reader 9 no longer use the embedded thumbnail.

Parameters

image:ImageElement


Throws
DocumentError
setViewerPreferences()method 
public function setViewerPreferences(preferences:int):void

Set the view preferences for this document

Parameters

preferences:int

See also

top()method 
public function top(margin:Number = 0):Number

Parameters

margin:Number (default = 0)

Returns
Number
traverseOutlineCount()method 
public function traverseOutlineCount(outline:PdfOutline):void

Parameters

outline:PdfOutline

writeLineToContent()method 
pdf_core function writeLineToContent(line:PdfLine, text:PdfContentByte, graphics:PdfContentByte, currentValues:Vector.<Object>, ratio:Number):void

Writes a text line to the document. It takes care of all the attributes.

Parameters

line:PdfLine
 
text:PdfContentByte
 
graphics:PdfContentByte
 
currentValues:Vector.<Object>
 
ratio:Number


Throws
DocumentError
 
Error
writeOutlines()method 
public function writeOutlines():void

Event Detail
chapterEnd Event
Event Object Type: org.purepdf.events.ChapterEvent

chapterStart Event  
Event Object Type: org.purepdf.events.ChapterEvent

documentClose Event  
Event Object Type: org.purepdf.events.PageEvent

documentOpen Event  
Event Object Type: org.purepdf.events.PageEvent

genericTag Event  
Event Object Type: org.purepdf.events.ChunkEvent

pageEnd Event  
Event Object Type: org.purepdf.events.PageEvent

pageStart Event  
Event Object Type: org.purepdf.events.PageEvent

paragraphEnd Event  
Event Object Type: org.purepdf.events.ParagraphEvent

paragraphStart Event  
Event Object Type: org.purepdf.events.ParagraphEvent

progress Event  
Event Object Type: flash.events.ProgressEvent

saveComplete Event  
Event Object Type: org.purepdf.events.DocumentEvent

saveStart Event  
Event Object Type: org.purepdf.events.DocumentEvent

sectionEnd Event  
Event Object Type: org.purepdf.events.SectionEvent

sectionStart Event  
Event Object Type: org.purepdf.events.SectionEvent

Constant Detail
DID_PRINTConstant
public static const DID_PRINT:PdfName

DID_SAVEConstant 
public static const DID_SAVE:PdfName

DOCUMENT_CLOSEConstant 
public static const DOCUMENT_CLOSE:PdfName

hangingPunctuationConstant 
public static const hangingPunctuation:String = .,;:'

WILL_PRINTConstant 
public static const WILL_PRINT:PdfName

WILL_SAVEConstant 
public static const WILL_SAVE:PdfName

wmfFontCorrectionConstant 
public static const wmfFontCorrection:Number = 0.86