Packageorg.purepdf.pdf
Classpublic class PdfReader
InheritancePdfReader Inheritance flash.events.EventDispatcher



Public Properties
 PropertyDefined By
  appendable : Boolean
[read-only]
PdfReader
  catalog : PdfDictionary
PdfReader
  currentStep : int = 0
PdfReader
  decrypt : PdfEncryption
[read-only]
PdfReader
  hybridXref : Boolean
PdfReader
  lastXrefPartial : int = -1
PdfReader
  newXrefType : Boolean
PdfReader
  numberOfPages : int
[read-only] Gets the number of pages in the document.
PdfReader
  partial : Boolean
PdfReader
  pdfVersion : int
[read-only]
PdfReader
  rootPages : PdfDictionary
PdfReader
  tokens : PRTokeniser
PdfReader
  totalSteps : int = 3
PdfReader
  xref : Vector.<int>
PdfReader
Protected Properties
 PropertyDefined By
  _decrypt : PdfEncryption
PdfReader
  encrypted : Boolean = false
PdfReader
  eofPos : int
PdfReader
  lastXref : int
PdfReader
  objStmMark : HashMap
PdfReader
  objStmToOffset : HashMap
PdfReader
  pageRefs : PageRefs
PdfReader
  _pdfVersion : int
PdfReader
  pValue : int
PdfReader
  rebuilt : Boolean
PdfReader
  rValue : int
PdfReader
  sharedStreams : Boolean = true
PdfReader
  strings : Vector.<PdfString>
PdfReader
  trailer : PdfDictionary
PdfReader
Public Methods
 MethodDefined By
  
PdfReader(input:ByteArray)
PdfReader
  
_FlateDecode(input:Bytes, strict:Boolean):Bytes
[static] A helper to FlateDecode.
PdfReader
  
PdfReader
  
Gets the page from a page dictionary
PdfReader
  
Gets the rotated page from a page dictionary.
PdfReader
  
[static] Decodes a stream that has the ASCII85Decode filter.
PdfReader
  
[static] Decodes a stream that has the ASCIIHexDecode filter.
PdfReader
  
[static]
PdfReader
  
ensureXrefSize(size:int):void
PdfReader
  
[static] Decodes a stream that has the FlateDecode filter.
PdfReader
  
PdfReader
  
Getter for property fileLength.
PdfReader
  
getInfo():HashMap
Returns the content of the document information dictionary as a HashMap of String.
PdfReader
  
[static] Normalizes a RectangleElement so that llx and lly are smaller than urx and ury.
PdfReader
  
Gets the number of pages in the document.
PdfReader
  
getPageN(pageNum:int):PdfDictionary
Gets the dictionary that represents a page.
PdfReader
  
Gets the page reference to this page.
PdfReader
  
getPageRotation(index:int):int
Gets the page rotation.
PdfReader
  
Gets the page size without taking rotation into account.
PdfReader
  
Gets the page size, taking rotation into account.
PdfReader
  
PdfReader
  
[static]
PdfReader
  
PdfReader
  
[static]
PdfReader
  
[static]
PdfReader
  
Gets a new file instance of the original PDF document.
PdfReader
  
[static] Get the content from a stream applying the required filters.
PdfReader
  
[static] Get the content from a stream applying the required filters.
PdfReader
  
[static] Get the content from a stream as it is without applying any filter.
PdfReader
  
[static] Get the content from a stream as it is without applying any filter.
PdfReader
  
PdfReader
  
getxref():Vector.<int>
PdfReader
  
PdfReader
  
Gets the number of xref objects.
PdfReader
  
isEncrypted():Boolean
Returns true if the PDF is encrypted.
PdfReader
  
isRebuilt():Boolean
Checks if the document had errors and was rebuilt.
PdfReader
  
readPdf(removeUnused:Boolean = false):void
Start parsing the current pdf document.
PdfReader
  
PdfReader
  
readXRefStream(ptr:int):Boolean
PdfReader
  
PdfReader
  
[static]
PdfReader
  
releasePage(pageNum:int):void
PdfReader
  
Removes all the unreachable objects.
PdfReader
  
PdfReader
  
setObjGen(value:int):void
PdfReader
  
setObjNum(value:int):void
PdfReader
Protected Methods
 MethodDefined By
  
Eliminates shared streams if they exist.
PdfReader
  
PdfReader
  
PdfReader
  
readDocObj():void
PdfReader
  
readObjStm(stream:PRStream, map:HashMap):void
PdfReader
  
PdfReader
  
readPages():void
PdfReader
  
PdfReader
  
readXref():void
PdfReader
  
PdfReader
  
removeUnusedNode(obj:PdfObject, hits:Vector.<Boolean>):void
PdfReader
Public Constants
 ConstantDefined By
  pageInhCandidates : Vector.<PdfName>
[static]
PdfReader
  TIMER_STEP : int = 300
[static]
PdfReader
Property Detail
_decryptproperty
protected var _decrypt:PdfEncryption

_pdfVersionproperty 
protected var _pdfVersion:int

appendableproperty 
appendable:Boolean  [read-only]


Implementation
    public function get appendable():Boolean
catalogproperty 
public var catalog:PdfDictionary

currentStepproperty 
public var currentStep:int = 0

decryptproperty 
decrypt:PdfEncryption  [read-only]


Implementation
    public function get decrypt():PdfEncryption
encryptedproperty 
protected var encrypted:Boolean = false

eofPosproperty 
protected var eofPos:int

hybridXrefproperty 
public var hybridXref:Boolean

lastXrefproperty 
protected var lastXref:int

lastXrefPartialproperty 
public var lastXrefPartial:int = -1

newXrefTypeproperty 
public var newXrefType:Boolean

numberOfPagesproperty 
numberOfPages:int  [read-only]

Gets the number of pages in the document.


Implementation
    public function get numberOfPages():int
objStmMarkproperty 
protected var objStmMark:HashMap

objStmToOffsetproperty 
protected var objStmToOffset:HashMap

pageRefsproperty 
protected var pageRefs:PageRefs

partialproperty 
public var partial:Boolean

pdfVersionproperty 
pdfVersion:int  [read-only]


Implementation
    public function get pdfVersion():int
pValueproperty 
protected var pValue:int

rebuiltproperty 
protected var rebuilt:Boolean

rootPagesproperty 
public var rootPages:PdfDictionary

rValueproperty 
protected var rValue:int

sharedStreamsproperty 
protected var sharedStreams:Boolean = true

stringsproperty 
protected var strings:Vector.<PdfString>

tokensproperty 
public var tokens:PRTokeniser

totalStepsproperty 
public var totalSteps:int = 3

trailerproperty 
protected var trailer:PdfDictionary

xrefproperty 
public var xref:Vector.<int>

Constructor Detail
PdfReader()Constructor
public function PdfReader(input:ByteArray)



Parameters
input:ByteArray
Method Detail
_FlateDecode()method
public static function _FlateDecode(input:Bytes, strict:Boolean):Bytes

A helper to FlateDecode.

Parameters

input:Bytes — the input data
 
strict:Boolean — true to read a correct stream. false to try to read a corrupted stream

Returns
Bytes — the decoded data
_getPageRotation()method 
public function _getPageRotation(page:PdfDictionary):int

Parameters

page:PdfDictionary

Returns
int
_getPageSize()method 
public function _getPageSize(page:PdfDictionary):RectangleElement

Gets the page from a page dictionary

Parameters

page:PdfDictionary — the page dictionary

Returns
RectangleElement — the page
_getPageSizeWithRotation()method 
public function _getPageSizeWithRotation(page:PdfDictionary):RectangleElement

Gets the rotated page from a page dictionary.

Parameters

page:PdfDictionary — the page dictionary

Returns
RectangleElement — the rotated page
ASCII85Decode()method 
public static function ASCII85Decode(input:Bytes):Bytes

Decodes a stream that has the ASCII85Decode filter.

Parameters

input:Bytes — the input data

Returns
Bytes — the decoded data

Throws
RuntimeError
ASCIIHexDecode()method 
public static function ASCIIHexDecode(input:Bytes):Bytes

Decodes a stream that has the ASCIIHexDecode filter.

Parameters

input:Bytes — the input data

Returns
Bytes — the decoded data

Throws
RuntimeError
decodePredictor()method 
public static function decodePredictor(input:Bytes, dicPar:PdfObject):Bytes

Parameters

input:Bytes
 
dicPar:PdfObject

Returns
Bytes
eliminateSharedStreams()method 
protected function eliminateSharedStreams():void

Eliminates shared streams if they exist.

ensureXrefSize()method 
public function ensureXrefSize(size:int):void

Parameters

size:int

FlateDecode()method 
public static function FlateDecode(input:Bytes):Bytes

Decodes a stream that has the FlateDecode filter.

Parameters

input:Bytes — the input data

Returns
Bytes — the decoded data
getCatalog()method 
public function getCatalog():PdfDictionary

Returns
PdfDictionary
getFileLength()method 
public function getFileLength():int

Getter for property fileLength.

Returns
int — Value of property fileLength.
getInfo()method 
public function getInfo():HashMap

Returns the content of the document information dictionary as a HashMap of String.

Returns
HashMap — content of the document information dictionary
getNormalizedRectangle()method 
public static function getNormalizedRectangle(box:PdfArray):RectangleElement

Normalizes a RectangleElement so that llx and lly are smaller than urx and ury.

Parameters

box:PdfArray — the original rectangle

Returns
RectangleElement — a normalized RectangleElement
getNumberOfPages()method 
public function getNumberOfPages():int

Gets the number of pages in the document.

Returns
int — the number of pages in the document
getPageN()method 
public function getPageN(pageNum:int):PdfDictionary

Gets the dictionary that represents a page.

Parameters

pageNum:int — the page number. 1 is the first

Returns
PdfDictionary — the page dictionary
getPageOrigRef()method 
public function getPageOrigRef(pageNum:int):PRIndirectReference

Gets the page reference to this page.

Parameters

pageNum:int — the page number. 1 is the first

Returns
PRIndirectReference — the page reference
getPageRotation()method 
public function getPageRotation(index:int):int

Gets the page rotation. This value can be 0, 90, 180 or 270.

Parameters

index:int — the page number. The first page is 1

Returns
int — the page rotation
getPageSize()method 
public function getPageSize(index:int):RectangleElement

Gets the page size without taking rotation into account. This is the value of the /MediaBox key.

Parameters

index:int — the page number. The first page is 1

Returns
RectangleElement — the page size
getPageSizeWithRotation()method 
public function getPageSizeWithRotation(index:int):RectangleElement

Gets the page size, taking rotation into account. This is a RectangleElement with the value of the /MediaBox and the /Rotate key.

Parameters

index:int — the page number. The first page is 1

Returns
RectangleElement — a RectangleElement
getPdfObject()method 
public function getPdfObject(idx:int):PdfObject

Parameters

idx:int

Returns
PdfObject
getPdfObject()method 
public static function getPdfObject(obj:PdfObject):PdfObject

Parameters

obj:PdfObject

Returns
PdfObject
getPdfObjectRelease()method 
public function getPdfObjectRelease(idx:int):PdfObject

Parameters

idx:int

Returns
PdfObject
getPdfObjectRelease()method 
public static function getPdfObjectRelease(obj:PdfObject):PdfObject

Parameters

obj:PdfObject

Returns
PdfObject
getPdfObjects()method 
public static function getPdfObjects(obj:PdfObject, parent:PdfObject):PdfObject

Parameters

obj:PdfObject
 
parent:PdfObject

Returns
PdfObject
getSafeFile()method 
public function getSafeFile():RandomAccessFileOrArray

Gets a new file instance of the original PDF document.

Returns
RandomAccessFileOrArray — a new file instance of the original PDF document
getStreamBytes()method 
public static function getStreamBytes(stream:PRStream, file:RandomAccessFileOrArray):Bytes

Get the content from a stream applying the required filters.

Parameters

stream:PRStream — the stream
 
file:RandomAccessFileOrArray — the location where the stream is

Returns
Bytes — the stream content
getStreamBytes2()method 
public static function getStreamBytes2(stream:PRStream):Bytes

Get the content from a stream applying the required filters.

Parameters

stream:PRStream — the stream

Returns
Bytes — the stream content
getStreamBytesRaw()method 
public static function getStreamBytesRaw(stream:PRStream, file:RandomAccessFileOrArray):Bytes

Get the content from a stream as it is without applying any filter.

Parameters

stream:PRStream — the stream
 
file:RandomAccessFileOrArray — the location where the stream is

Returns
Bytes — the stream content
getStreamBytesRaw2()method 
public static function getStreamBytesRaw2(stream:PRStream):Bytes

Get the content from a stream as it is without applying any filter.

Parameters

stream:PRStream — the stream

Returns
Bytes — the stream content
getTokens()method 
public function getTokens():PRTokeniser

Returns
PRTokeniser
getxref()method 
public function getxref():Vector.<int>

Returns
Vector.<int>
getxrefobj()method 
public function getxrefobj():Vector.<PdfObject>

Returns
Vector.<PdfObject>
getXrefSize()method 
public function getXrefSize():int

Gets the number of xref objects.

Returns
int — the number of xref objects
isEncrypted()method 
public function isEncrypted():Boolean

Returns true if the PDF is encrypted.

Returns
Boolean — true if the PDF is encrypted
isRebuilt()method 
public function isRebuilt():Boolean

Checks if the document had errors and was rebuilt.

Returns
Boolean — true if rebuilt.
readArray()method 
protected function readArray():PdfArray

Returns
PdfArray
readDictionary()method 
protected function readDictionary():PdfDictionary

Returns
PdfDictionary
readDocObj()method 
protected function readDocObj():void

readObjStm()method 
protected function readObjStm(stream:PRStream, map:HashMap):void

Parameters

stream:PRStream
 
map:HashMap

readOneObjStm()method 
protected function readOneObjStm(stream:PRStream, idx:int):PdfObject

Parameters

stream:PRStream
 
idx:int

Returns
PdfObject
readPages()method 
protected function readPages():void

readPdf()method 
public function readPdf(removeUnused:Boolean = false):void

Start parsing the current pdf document. If the parameter removeUnused is set to true then all the unused nodes will be removed one the parsing process has ended.

Parameters

removeUnused:Boolean (default = false)

readPRObject()method 
public function readPRObject():PdfObject

Returns
PdfObject
readSingleObject()method 
protected function readSingleObject(k:int):PdfObject

Parameters

k:int

Returns
PdfObject
readXref()method 
protected function readXref():void

readXRefStream()method 
public function readXRefStream(ptr:int):Boolean

Parameters

ptr:int

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

releaseLastXrefPartial()method 
public function releaseLastXrefPartial():void

releaseLastXrefPartial()method 
public static function releaseLastXrefPartial(obj:PdfObject):void

Parameters

obj:PdfObject

releasePage()method 
public function releasePage(pageNum:int):void

Parameters

pageNum:int

removeUnusedNode()method 
protected function removeUnusedNode(obj:PdfObject, hits:Vector.<Boolean>):void

Parameters

obj:PdfObject
 
hits:Vector.<Boolean>

removeUnusedObjects()method 
public function removeUnusedObjects():int

Removes all the unreachable objects.

Returns
int — the number of indirect objects removed
resetLastXrefPartial()method 
public function resetLastXrefPartial():void

setObjGen()method 
public function setObjGen(value:int):void

Parameters

value:int

setObjNum()method 
public function setObjNum(value:int):void

Parameters

value:int

Constant Detail
pageInhCandidatesConstant
public static const pageInhCandidates:Vector.<PdfName>

TIMER_STEPConstant 
public static const TIMER_STEP:int = 300