com.lowagie.text.pdf
Class PdfStructureTreeRoot

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.PdfStructureTreeRoot

public class PdfStructureTreeRoot
extends PdfStructureBase

The structure tree root corresponds to the highest hierarchy level in a tagged PDF.

Author:
Paulo Soares (psoares@consiste.pt)

Field Summary
private  int nextMark
           
private  Map pageMCIDs
           
private  HashMap parentTree
           
private  PdfWriter writer
           
 
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
PdfStructureTreeRoot(PdfWriter writer)
           
 
Method Summary
(package private)  void buildTree()
           
 int getMCIDForPage(int pageIdx)
          will NPE if pageIdx is unknown
 Integer getMCIDForPage(Integer pageIdx)
          retrieves the existing MCID for a given page.
 int getNextMCID()
          returns the next Marked Content ID.
 PdfWriter getWriter()
          Gets the writer.
 void mapRole(PdfName used, PdfName standard)
          Maps the user tags to the standard tags.
private  void nodeProcess(PdfDictionary struc, PdfIndirectReference reference)
           
 void setObjMark(int objID, PdfIndirectReference strucRef)
          Adds a structure element that is not part of a content item (annots & such)
 int setPageMark(int pageIdx, PdfIndirectReference struc)
          Adds a marked content item to the given page.
 void setPagesMCID(int pageIdx, int pageMCID)
          Sets the page's MCID.
 
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

parentTree

private HashMap parentTree

pageMCIDs

private Map pageMCIDs

nextMark

private int nextMark

writer

private PdfWriter writer
Constructor Detail

PdfStructureTreeRoot

PdfStructureTreeRoot(PdfWriter writer)
Parameters:
writer - a VALID PdfWriter. Or else.
Method Detail

mapRole

public void mapRole(PdfName used,
                    PdfName standard)
Maps the user tags to the standard tags. The mapping will allow a standard application to make some sense of the tagged document whatever the user tags may be.

Parameters:
used - the user tag
standard - the standard tag

getWriter

public PdfWriter getWriter()
Gets the writer.

Specified by:
getWriter in class PdfStructureBase
Returns:
You'll never guess.
Since:
2.1.5

getNextMCID

public int getNextMCID()
returns the next Marked Content ID.

Returns:
the next top-level MCID
Since:
2.1.5

setPagesMCID

public void setPagesMCID(int pageIdx,
                         int pageMCID)
Sets the page's MCID. "Pages" in the name is possessive, not plural.

Parameters:
pageIdx - That page thing we were just talking about.
pageMCID - The MCID for the page... Do try and keep up.
Since:
2.1.5

getMCIDForPage

public int getMCIDForPage(int pageIdx)
will NPE if pageIdx is unknown

Parameters:
pageIdx -
Returns:
the MCID for the given page
Since:
2.1.5

getMCIDForPage

public Integer getMCIDForPage(Integer pageIdx)
retrieves the existing MCID for a given page.

Parameters:
pageIdx -
Returns:
the MCID for the given page
Since:
2.1.5

setPageMark

public int setPageMark(int pageIdx,
                       PdfIndirectReference struc)
Adds a marked content item to the given page. It returns the index into that page's marked content array... the MCID (which isn't a unique ID, and has no bearing on reading order)

Parameters:
pageIdx - durh
struc - An indirect reference to the *structure element*
Returns:
MCID (aka index) for the referenced StructureElement
Since:
2.1.5

setObjMark

public void setObjMark(int objID,
                       PdfIndirectReference strucRef)
Adds a structure element that is not part of a content item (annots & such)

Parameters:
objID -
strucRef -
Since:
2.1.5

nodeProcess

private void nodeProcess(PdfDictionary struc,
                         PdfIndirectReference reference)
                  throws IOException
Throws:
IOException

buildTree

void buildTree()
         throws IOException
Throws:
IOException

Hosted by Hostbasket