com.lowagie.text.pdf
Class PdfStructureElement

java.lang.Object
  extended by com.lowagie.text.pdf.PdfObject
      extended by com.lowagie.text.pdf.PdfDictionary
          extended by com.lowagie.text.pdf.PdfStructureBase
              extended by com.lowagie.text.pdf.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
(package private)  class PdfStructureElement.PdfStructureMC
          A dictionary placed in the /K of a leaf structure element.
(package private)  class PdfStructureElement.PdfStructureObj
          Another dictionary residing in the /K of a leaf element.
 
Field Summary
private  boolean hasPageMark
           
private  Integer mcid
           
private  PdfStructureElement parent
           
private  PdfStructureTreeRoot top
           
 
Fields inherited from class com.lowagie.text.pdf.PdfStructureBase
kids
 
Fields inherited from class com.lowagie.text.pdf.PdfDictionary
CATALOG, FONT, hashMap, OUTLINES, PAGE, PAGES
 
Fields inherited from class com.lowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, indRef, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
 
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
private  void checkKids()
          Throw if this structure element is being used as a parent
static PdfStructureElement createNextElement(PdfStructureElement parent, PdfName structureType)
          Creates a new element and immediately assigns it the next MCID.
 int getMCID()
          Get/assign a marked content ID for this element.
 PdfDictionary getParent()
          Gets the parent of this node.
 PdfWriter getWriter()
          Should never be null...
private  void init(PdfStructureBase parent, PdfName structureType)
           
private  void init(PdfStructureBase parent, PdfName structureType, PdfIndirectReference ref)
           
 void setMarkedContent(PdfIndirectReference pageRef)
          sets this structure element to represent a particular section of marked content within the page indicated by pageRef
 void setMarkedObject(PdfIndirectReference objRef, PdfIndirectReference pageRef)
          Sets this StructElem up as a marked object.
 void setMCID(int id)
          Will throw if this element has >0 kids
private  void setObjMark()
           
(package private)  void setPageMark(int page)
           
 
Methods inherited from class com.lowagie.text.pdf.PdfStructureBase
addKid, getIndRef
 
Methods inherited from class com.lowagie.text.pdf.PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
 
Methods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getDirectObject, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

private PdfStructureElement parent

top

private PdfStructureTreeRoot top

mcid

private Integer mcid

hasPageMark

private boolean hasPageMark
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

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

getWriter

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

Specified by:
getWriter in class PdfStructureBase
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)

getParent

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

Returns:
the parent of this node

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

setMCID

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

Parameters:
id - MCID
Since:
2.1.5

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

setPageMark

void setPageMark(int page)
Parameters:
page -
Since:
2.1.5

setObjMark

private void setObjMark()
Since:
2.1.5

checkKids

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

Since:
2.1.5

Hosted by Hostbasket