com.lowagie.text.pdf

Class PdfStructureElement

public class PdfStructureElement extends PdfStructureBase

This is a node in a document logical structure. It may contain a mark point or it may contain other nodes.

Author: Paulo Soares (psoares@consiste.pt) Something to keep in mind about MCIDs. They're not really IDentifiers. They're InDexes into their container(a page or annotation at the moment)'s kid array. The name has lead to misconceptions that can be found across several popular PDF products (including LifeCycle Designer 8).

Nested Class Summary
classPdfStructureElement.PdfStructureMC
A dictionary placed in the /K of a leaf structure element.
classPdfStructureElement.PdfStructureObj
Another dictionary residing in the /K of a leaf element.
Field Summary
booleanhasPageMark
Integermcid
PdfStructureElementparent
PdfStructureTreeRoottop
Constructor Summary
PdfStructureElement(PdfStructureElement parent, PdfName structureType)
Creates a new instance of PdfStructureElement.
PdfStructureElement(PdfStructureElement parent, PdfName structType, PdfIndirectReference ref)
Constructs a new Element with a predetermined reference
PdfStructureElement(PdfStructureTreeRoot parent, PdfName structureType)
Creates a new instance of PdfStructureElement.
Method Summary
voidcheckKids()
Throw if this structure element is being used as a parent
static PdfStructureElementcreateNextElement(PdfStructureElement parent, PdfName structureType)
Creates a new element and immediately assigns it the next MCID.
intgetMCID()
Get/assign a marked content ID for this element.
PdfDictionarygetParent()
Gets the parent of this node.
PdfWritergetWriter()
Should never be null...
voidinit(PdfStructureBase parent, PdfName structureType)
voidinit(PdfStructureBase parent, PdfName structureType, PdfIndirectReference ref)
voidsetMarkedContent(PdfIndirectReference pageRef)
sets this structure element to represent a particular section of marked content within the page indicated by pageRef
voidsetMarkedObject(PdfIndirectReference objRef, PdfIndirectReference pageRef)
Sets this StructElem up as a marked object.
voidsetMCID(int id)
Will throw if this element has >0 kids
voidsetObjMark()
voidsetPageMark(int page)

Field Detail

hasPageMark

private boolean hasPageMark

mcid

private Integer mcid

parent

private PdfStructureElement parent

top

private PdfStructureTreeRoot top

Constructor Detail

PdfStructureElement

public PdfStructureElement(PdfStructureElement parent, PdfName structureType)
Creates a new instance of PdfStructureElement.

Parameters: parent the parent of this node structureType the type of structure. It may be a standard type or a user type mapped by the role map

PdfStructureElement

public PdfStructureElement(PdfStructureElement parent, PdfName structType, PdfIndirectReference ref)
Constructs a new Element with a predetermined reference

Parameters: parent structType ref

Since: 2.1.5

PdfStructureElement

public PdfStructureElement(PdfStructureTreeRoot parent, PdfName structureType)
Creates a new instance of PdfStructureElement.

Parameters: parent the parent of this node structureType the type of structure. It may be a standard type or a user type mapped by the role map

Method Detail

checkKids

private void checkKids()
Throw if this structure element is being used as a parent

Since: 2.1.5

createNextElement

public static PdfStructureElement createNextElement(PdfStructureElement parent, PdfName structureType)
Creates a new element and immediately assigns it the next MCID. NOTE: MCIDs do NOT control reading order. That's handled by parent/child relationships of StructureElements alone.

Parameters: parent Structure Thing to contain the new element structureType durh.

Returns: the new element, with its freshly minted MCID already assigned. NOTE: There is no version of this function that can use the TreeRoot as its parent, because that would be silly. Think about it.

Since: 2.1.5

getMCID

public int getMCID()
Get/assign a marked content ID for this element. WARNING: if this element has > 0 kids, calling this function will throw

Returns: the elements marked content ID.

Since: 2.1.5

getParent

public PdfDictionary getParent()
Gets the parent of this node.

Returns: the parent of this node

getWriter

public PdfWriter getWriter()
Should never be null... TreeRoot would have already thrown in it's constructor.

Returns: Gee, I wonder.

Since: 2.1.5

init

private void init(PdfStructureBase parent, PdfName structureType)

init

private void init(PdfStructureBase parent, PdfName structureType, PdfIndirectReference ref)

setMarkedContent

public void setMarkedContent(PdfIndirectReference pageRef)
sets this structure element to represent a particular section of marked content within the page indicated by pageRef

Parameters: pageRef the reference to a particular page

Since: 2.1.5

setMarkedObject

public void setMarkedObject(PdfIndirectReference objRef, PdfIndirectReference pageRef)
Sets this StructElem up as a marked object.

Parameters: objRef required pageRef may be null

Since: 2.1.5

setMCID

public void setMCID(int id)
Will throw if this element has >0 kids

Parameters: id MCID

Since: 2.1.5

setObjMark

private void setObjMark()

Since: 2.1.5

setPageMark

void setPageMark(int page)

Parameters: page

Since: 2.1.5