Packageorg.purepdf.pdf
Classpublic class PdfWriter
InheritancePdfWriter Inheritance it.sephiroth.utils.ObjectHash
Subclasses PdfCopyFieldsImp



Public Properties
 PropertyDefined By
  compressionLevel : int
[read-only] Returns the compression level used for streams written by this writer.
PdfWriter
  crypto : PdfEncryption
PdfWriter
  pageNumber : int
[read-only] Gets the pagenumber of this document.
PdfWriter
  pdfDocument : PdfDocument
[read-only]
PdfWriter
  pdfIndirectReference : PdfIndirectReference
[read-only] Use this to get an PdfIndirectReference for an object that will be created in the future.
PdfWriter
  rgbTransparencyBlending : Boolean
Gets the transparency blending colorspace
PdfWriter
  spaceCharRatio : Number
[read-only]
PdfWriter
  structureTreeRoot : PdfStructureTreeRoot
[read-only] Gets the structure tree root.
PdfWriter
  tagged : Boolean
PdfWriter
  userProperties : Boolean
Sets the flag indicating the presence of structure elements that contain user properties attributes.
PdfWriter
  userunit : Number
PdfWriter
Protected Properties
 PropertyDefined By
  body : PdfBody
PdfWriter
  colorNumber : int = 1
PdfWriter
  _compressionLevel : int
PdfWriter
  currentPageNumber : int = 1
PdfWriter
  defaultColorspace : PdfDictionary
PdfWriter
  defaultPageSize : PageSize
PdfWriter
  directContent : PdfContentByte
PdfWriter
  directContentUnder : PdfContentByte
PdfWriter
  documentColors : HashMap
PdfWriter
  documentExtGState : HashMap
PdfWriter
  documentFonts : HashMap
PdfWriter
  documentOCG : HashSet
PdfWriter
  documentOCGOrder : Vector.<IPdfOCG>
PdfWriter
  documentPatterns : HashMap
PdfWriter
  documentProperties : HashMap
PdfWriter
  documentShadingPatterns : HashMap
PdfWriter
  documentShadings : HashMap
PdfWriter
  documentSpotPatterns : HashMap
PdfWriter
  extraCatalog : PdfDictionary
PdfWriter
  fontCount : int = 1
PdfWriter
  formXObjects : HashMap
PdfWriter
  formXObjectsCounter : int = 1
PdfWriter
  fullCompression : Boolean = false
PdfWriter
  group : PdfDictionary
PdfWriter
  imageDictionary : PdfDictionary
PdfWriter
  images : HashMap
PdfWriter
  newBookmarks : Array
PdfWriter
  OCGLocked : PdfArray
PdfWriter
  OCGRadioGroup : PdfArray
PdfWriter
  OCProperties : PdfOCProperties
PdfWriter
  opened : Boolean = false
PdfWriter
  os : OutputStreamCounter
PdfWriter
  pageReferences : Vector.<PdfIndirectReference>
PdfWriter
  patternColorspaceCMYK : ColorDetails
PdfWriter
  patternColorspaceGRAY : ColorDetails
PdfWriter
  patternColorspaceRGB : ColorDetails
PdfWriter
  patternCounter : int = 1
PdfWriter
  paused : Boolean = false
PdfWriter
  pdf : PdfDocument
PdfWriter
  pdf_version : PdfVersion
PdfWriter
  prevxref : int = 0
PdfWriter
  _rgbTransparencyBlending : Boolean
PdfWriter
  root : PdfPages
PdfWriter
  runDirection : int = 1
PdfWriter
  _structureTreeRoot : PdfStructureTreeRoot
PdfWriter
  tabs : PdfName = null
PdfWriter
  _tagged : Boolean = false
PdfWriter
  _userunit : Number = 0
PdfWriter
  xmpMetadata : Bytes = null
PdfWriter
Public Methods
 MethodDefined By
  
PdfWriter(instance:Lock, output:ByteArray, pagesize:RectangleElement)
PdfWriter
  
PdfWriter
  
addLocalDestinations(dest:HashMap):void
PdfWriter
  
close():void
PdfWriter
  
create(output:ByteArray, pagesize:RectangleElement):PdfWriter
[static]
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
PdfWriter
  
Use this method to get the info dictionary if you want to change it directly (add keys and values to the info dictionary).
PdfWriter
  
getISOBytes(text:String):Bytes
[static]
PdfWriter
  
PdfWriter
  
PdfWriter
  
Use this method to get a reference to a page existing or not.
PdfWriter
  
PdfWriter
  
PdfWriter
  
getVectorISOBytes(text:String):Vector.<int>
[static]
PdfWriter
  
PdfWriter
  
isOpen():Boolean
PdfWriter
  
isPaused():Boolean
PdfWriter
  
Gets the transparency blending colorspace.
PdfWriter
  
lockLayer(layer:PdfLayer):void
PdfWriter
  
PdfWriter
  
PdfWriter
  
Resets all the direct contents to empty.
PdfWriter
  
setAtLeastPdfVersion(version:String):void
PdfWriter
  
PdfWriter
  
PdfWriter
  
Set the document compression to the PDF 1.5 mode with object streams ans xref streams.
PdfWriter
  
PdfWriter
  
setOutlines(outlines:Array):void
PdfWriter
  
setPdfVersion(value:String):void
PdfWriter
  
setTabs(value:PdfName):void
PdfWriter
Protected Methods
 MethodDefined By
  
PdfWriter
  
fillOCProperties(erase:Boolean):void
PdfWriter
  
PdfWriter
  
writeOutlines(catalog:PdfDictionary, namedAsNames:Boolean):void
PdfWriter
Public Constants
 ConstantDefined By
  BUILD_DATE : String = 20100527
[static]
PdfWriter
  BUILD_NUMBER : String = 74
[static]
PdfWriter
  ENCRYPTION_AES_128 : int = 2
[static]
PdfWriter
  GENERATION_MAX : int = 65535
[static]
PdfWriter
  MAIN_VERSION : String = 0
[static]
PdfWriter
  NAME : String = purepdf
[static]
PdfWriter
  NO_SPACE_CHAR_RATIO : Number = 10000000
[static]
PdfWriter
  RELEASE : String
[static]
PdfWriter
  RUN_DIRECTION_DEFAULT : int = 0
[static]
PdfWriter
  RUN_DIRECTION_LTR : int = 2
[static]
PdfWriter
  RUN_DIRECTION_NO_BIDI : int = 1
[static]
PdfWriter
  RUN_DIRECTION_RTL : int = 3
[static]
PdfWriter
  SPACE_CHAR_RATIO_DEFAULT : Number = 2.5
[static]
PdfWriter
  STANDARD_ENCRYPTION_128 : int = 1
[static]
PdfWriter
  STANDARD_ENCRYPTION_40 : int = 0
[static]
PdfWriter
  VERSION : String
[static]
PdfWriter
Property Detail
_compressionLevelproperty
protected var _compressionLevel:int

_rgbTransparencyBlendingproperty 
protected var _rgbTransparencyBlending:Boolean

_structureTreeRootproperty 
protected var _structureTreeRoot:PdfStructureTreeRoot

_taggedproperty 
protected var _tagged:Boolean = false

_userunitproperty 
protected var _userunit:Number = 0

bodyproperty 
protected var body:PdfBody

colorNumberproperty 
protected var colorNumber:int = 1

compressionLevelproperty 
compressionLevel:int  [read-only]

Returns the compression level used for streams written by this writer.


Implementation
    public function get compressionLevel():int
cryptoproperty 
public var crypto:PdfEncryption

currentPageNumberproperty 
protected var currentPageNumber:int = 1

defaultColorspaceproperty 
protected var defaultColorspace:PdfDictionary

defaultPageSizeproperty 
protected var defaultPageSize:PageSize

directContentproperty 
protected var directContent:PdfContentByte

directContentUnderproperty 
protected var directContentUnder:PdfContentByte

documentColorsproperty 
protected var documentColors:HashMap

documentExtGStateproperty 
protected var documentExtGState:HashMap

documentFontsproperty 
protected var documentFonts:HashMap

documentOCGproperty 
protected var documentOCG:HashSet

documentOCGOrderproperty 
protected var documentOCGOrder:Vector.<IPdfOCG>

documentPatternsproperty 
protected var documentPatterns:HashMap

documentPropertiesproperty 
protected var documentProperties:HashMap

documentShadingPatternsproperty 
protected var documentShadingPatterns:HashMap

documentShadingsproperty 
protected var documentShadings:HashMap

documentSpotPatternsproperty 
protected var documentSpotPatterns:HashMap

extraCatalogproperty 
protected var extraCatalog:PdfDictionary

fontCountproperty 
protected var fontCount:int = 1

formXObjectsproperty 
protected var formXObjects:HashMap

formXObjectsCounterproperty 
protected var formXObjectsCounter:int = 1

fullCompressionproperty 
protected var fullCompression:Boolean = false

groupproperty 
protected var group:PdfDictionary

imageDictionaryproperty 
protected var imageDictionary:PdfDictionary

imagesproperty 
protected var images:HashMap

newBookmarksproperty 
protected var newBookmarks:Array

OCGLockedproperty 
protected var OCGLocked:PdfArray

OCGRadioGroupproperty 
protected var OCGRadioGroup:PdfArray

OCPropertiesproperty 
protected var OCProperties:PdfOCProperties

openedproperty 
protected var opened:Boolean = false

osproperty 
protected var os:OutputStreamCounter

pageNumberproperty 
pageNumber:int  [read-only]

Gets the pagenumber of this document. This number can be different from the real pagenumber, if you have (re)set the page number previously.


Implementation
    public function get pageNumber():int
pageReferencesproperty 
protected var pageReferences:Vector.<PdfIndirectReference>

patternColorspaceCMYKproperty 
protected var patternColorspaceCMYK:ColorDetails

patternColorspaceGRAYproperty 
protected var patternColorspaceGRAY:ColorDetails

patternColorspaceRGBproperty 
protected var patternColorspaceRGB:ColorDetails

patternCounterproperty 
protected var patternCounter:int = 1

pausedproperty 
protected var paused:Boolean = false

pdfproperty 
protected var pdf:PdfDocument

pdf_versionproperty 
protected var pdf_version:PdfVersion

pdfDocumentproperty 
pdfDocument:PdfDocument  [read-only]


Implementation
    public function get pdfDocument():PdfDocument
pdfIndirectReferenceproperty 
pdfIndirectReference:PdfIndirectReference  [read-only]

Use this to get an PdfIndirectReference for an object that will be created in the future. Use this method only if you know what you're doing!


Implementation
    public function get pdfIndirectReference():PdfIndirectReference
prevxrefproperty 
protected var prevxref:int = 0

rgbTransparencyBlendingproperty 
rgbTransparencyBlending:Boolean

Gets the transparency blending colorspace


Implementation
    public function get rgbTransparencyBlending():Boolean
    public function set rgbTransparencyBlending(value:Boolean):void
rootproperty 
protected var root:PdfPages

runDirectionproperty 
protected var runDirection:int = 1

spaceCharRatioproperty 
spaceCharRatio:Number  [read-only]


Implementation
    public function get spaceCharRatio():Number
structureTreeRootproperty 
structureTreeRoot:PdfStructureTreeRoot  [read-only]

Gets the structure tree root. If the document is not marked for tagging it will return null.


Implementation
    public function get structureTreeRoot():PdfStructureTreeRoot
tabsproperty 
protected var tabs:PdfName = null

taggedproperty 
tagged:Boolean


Implementation
    public function get tagged():Boolean
    public function set tagged(value:Boolean):void
userPropertiesproperty 
userProperties:Boolean

Sets the flag indicating the presence of structure elements that contain user properties attributes.


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


Implementation
    public function get userunit():Number
    public function set userunit(value:Number):void
xmpMetadataproperty 
protected var xmpMetadata:Bytes = null

Constructor Detail
PdfWriter()Constructor
public function PdfWriter(instance:Lock, output:ByteArray, pagesize:RectangleElement)



Parameters
instance:Lock
 
output:ByteArray
 
pagesize:RectangleElement
Method Detail
add()method
public function add(page:PdfPage, contents:PdfContents):PdfIndirectReference

Parameters

page:PdfPage
 
contents:PdfContents

Returns
PdfIndirectReference
addDirectImageSimple()method 
pdf_core function addDirectImageSimple(image:ImageElement):PdfName

Parameters

image:ImageElement

Returns
PdfName
addDirectImageSimple2()method 
pdf_core function addDirectImageSimple2(image:ImageElement, fixedRef:PdfIndirectReference):PdfName

Parameters

image:ImageElement
 
fixedRef:PdfIndirectReference

Returns
PdfName
addDirectTemplateSimple()method 
pdf_core function addDirectTemplateSimple(template:PdfTemplate, forcedName:PdfName):PdfName

Adds a template to the document but not to the page resources.

Parameters

template:PdfTemplate — the template to add
 
forcedName:PdfName — the template name, rather than a generated one. Can be null

Returns
PdfName — the PdfName for this template
addLocalDestinations()method 
public function addLocalDestinations(dest:HashMap):void

Parameters

dest:HashMap

addSharedObjectsToBody()method 
protected function addSharedObjectsToBody():void

addSimpleExtGState()method 
pdf_core function addSimpleExtGState(gstate:PdfDictionary):Vector.<PdfObject>

Parameters

gstate:PdfDictionary

Returns
Vector.<PdfObject>
addSimpleFont()method 
pdf_core function addSimpleFont(bf:BaseFont):FontDetails

Adds a font to the document but not to the page resources. It is used for templates.

Parameters

bf:BaseFont

Returns
FontDetails

See also

addSimplePattern()method 
pdf_core function addSimplePattern(painter:PdfPatternPainter):PdfName

Parameters

painter:PdfPatternPainter

Returns
PdfName
addSimplePatternColorSpace()method 
pdf_core function addSimplePatternColorSpace(color:RGBColor):ColorDetails

Parameters

color:RGBColor

Returns
ColorDetails
addSimpleProperty()method 
pdf_core function addSimpleProperty(prop:Object, refi:PdfIndirectReference):Vector.<PdfObject>

adding properties (OCG, marked content)

Parameters

prop:Object
 
refi:PdfIndirectReference

Returns
Vector.<PdfObject>
addSimpleShading()method 
pdf_core function addSimpleShading(value:PdfShading):void

Parameters

value:PdfShading

addSimpleShadingPattern()method 
pdf_core function addSimpleShadingPattern(shading:PdfShadingPattern):void

Parameters

shading:PdfShadingPattern

addSimpleSpotColor()method 
pdf_core function addSimpleSpotColor(spc:PdfSpotColor):ColorDetails

Adds a SpotColor to the document but not to the page resources.

Parameters

spc:PdfSpotColor — the SpotColor

Returns
ColorDetails — a Vector of Objects where position 0 is a PdfName and position 1 is an PdfIndirectReference
addToBody()method 
pdf_core function addToBody(object:PdfObject):PdfIndirectObject

Parameters

object:PdfObject

Returns
PdfIndirectObject
addToBody1()method 
pdf_core function addToBody1(object:PdfObject, ref:PdfIndirectReference):PdfIndirectObject

Parameters

object:PdfObject
 
ref:PdfIndirectReference

Returns
PdfIndirectObject
addToBody2()method 
pdf_core function addToBody2(object:PdfObject, inObjStm:Boolean):PdfIndirectObject

Parameters

object:PdfObject
 
inObjStm:Boolean

Returns
PdfIndirectObject
close()method 
public function close():void

create()method 
public static function create(output:ByteArray, pagesize:RectangleElement):PdfWriter

Parameters

output:ByteArray
 
pagesize:RectangleElement

Returns
PdfWriter
eliminateFontSubset()method 
pdf_core function eliminateFontSubset(fonts:PdfDictionary):void

Parameters

fonts:PdfDictionary

fillOCProperties()method 
protected function fillOCProperties(erase:Boolean):void

Parameters

erase:Boolean

getCatalog()method 
protected function getCatalog(rootObj:PdfIndirectReference):PdfDictionary

Parameters

rootObj:PdfIndirectReference

Returns
PdfDictionary
getColorspaceName()method 
public function getColorspaceName():PdfName

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

Returns
PdfIndirectReference
getCurrentPageNumber()method 
public function getCurrentPageNumber():int

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

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

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

Returns
PdfContentByte
getEncryption()method 
public function getEncryption():PdfEncryption

Returns
PdfEncryption
getExtraCatalog()method 
public function getExtraCatalog():PdfDictionary

Returns
PdfDictionary
getGroup()method 
public function getGroup():PdfDictionary

Returns
PdfDictionary
getImageReference()method 
public function getImageReference(name:PdfName):PdfIndirectReference

Parameters

name:PdfName

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

Use this method to get the info dictionary if you want to change it directly (add keys and values to the info dictionary).

Returns
PdfDictionary — the info dictionary
getISOBytes()method 
public static function getISOBytes(text:String):Bytes

Parameters

text:String

Returns
Bytes
getOCProperties()method 
public function getOCProperties():PdfOCProperties

Returns
PdfOCProperties
getOs()method 
public function getOs():OutputStreamCounter

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

Use this method to get a reference to a page existing or not. If the page does not exist yet the reference will be created in advance. If on closing the document, a page number greater than the total number of pages was requested, an exception is thrown.

Parameters

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

Returns
PdfIndirectReference — the reference to the page
getPdfVersion()method 
public function getPdfVersion():PdfVersion

Returns
PdfVersion
getTabs()method 
public function getTabs():PdfName

Returns
PdfName
getVectorISOBytes()method 
public static function getVectorISOBytes(text:String):Vector.<int>

Parameters

text:String

Returns
Vector.<int>
isFullCompression()method 
public function isFullCompression():Boolean

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

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

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

Gets the transparency blending colorspace.

Returns
Booleantrue if the transparency blending colorspace is RGB, false if it is the default blending colorspace
lockLayer()method 
public function lockLayer(layer:PdfLayer):void

Parameters

layer:PdfLayer

open()method 
public function open():PdfDocument

Returns
PdfDocument
propertyExists()method 
pdf_core function propertyExists(prop:Object):Boolean

Parameters

prop:Object

Returns
Boolean
registerLayer()method 
public function registerLayer(layer:IPdfOCG):void

Parameters

layer:IPdfOCG

resetContent()method 
public function resetContent():void

Resets all the direct contents to empty. This happens when a new page is started.

setAtLeastPdfVersion()method 
public function setAtLeastPdfVersion(version:String):void

Parameters

version:String

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

Parameters

key:PdfName — the name of the colorspace. It can be PdfName.DEFAULTGRAY, PdfName.DEFAULTRGB or PdfName.DEFAULTCMYK
 
value:PdfObject

setEncryption()method 
public function setEncryption(value:PdfEncryption):void

Parameters

value:PdfEncryption

setFullCompression()method 
public function setFullCompression():void

Set the document compression to the PDF 1.5 mode with object streams ans xref streams. Once set it can't be unset anymore.

setGroup()method 
public function setGroup(value:PdfDictionary):void

Parameters

value:PdfDictionary

setOutlines()method 
public function setOutlines(outlines:Array):void

Parameters

outlines:Array

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

Parameters

value:String

setTabs()method 
public function setTabs(value:PdfName):void

Parameters

value:PdfName

writeOutlines()method 
protected function writeOutlines(catalog:PdfDictionary, namedAsNames:Boolean):void

Parameters

catalog:PdfDictionary
 
namedAsNames:Boolean

Constant Detail
BUILD_DATEConstant
public static const BUILD_DATE:String = 20100527

BUILD_NUMBERConstant 
public static const BUILD_NUMBER:String = 74

ENCRYPTION_AES_128Constant 
public static const ENCRYPTION_AES_128:int = 2

GENERATION_MAXConstant 
public static const GENERATION_MAX:int = 65535

MAIN_VERSIONConstant 
public static const MAIN_VERSION:String = 0

NAMEConstant 
public static const NAME:String = purepdf

NO_SPACE_CHAR_RATIOConstant 
public static const NO_SPACE_CHAR_RATIO:Number = 10000000

RELEASEConstant 
public static const RELEASE:String

RUN_DIRECTION_DEFAULTConstant 
public static const RUN_DIRECTION_DEFAULT:int = 0

RUN_DIRECTION_LTRConstant 
public static const RUN_DIRECTION_LTR:int = 2

RUN_DIRECTION_NO_BIDIConstant 
public static const RUN_DIRECTION_NO_BIDI:int = 1

RUN_DIRECTION_RTLConstant 
public static const RUN_DIRECTION_RTL:int = 3

SPACE_CHAR_RATIO_DEFAULTConstant 
public static const SPACE_CHAR_RATIO_DEFAULT:Number = 2.5

STANDARD_ENCRYPTION_128Constant 
public static const STANDARD_ENCRYPTION_128:int = 1

STANDARD_ENCRYPTION_40Constant 
public static const STANDARD_ENCRYPTION_40:int = 0

VERSIONConstant 
public static const VERSION:String