Package com.itextpdf.text.pdf
Class PdfStructureElement
- java.lang.Object
-
- com.itextpdf.text.pdf.PdfObject
-
- com.itextpdf.text.pdf.PdfDictionary
-
- com.itextpdf.text.pdf.PdfStructureElement
-
- All Implemented Interfaces:
IPdfStructureElement
,java.io.Serializable
public class PdfStructureElement extends PdfDictionary implements IPdfStructureElement
This is a node in a document logical structure. It may contain a mark point or it may contain other nodes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private AccessibleElementId
elementId
private PdfStructureElement
parent
Holds value of property kids.private PdfIndirectReference
reference
Holds value of property reference.private PdfName
structureType
private PdfStructureTreeRoot
top
-
Constructor Summary
Constructors Modifier Constructor Description protected
PdfStructureElement(PdfDictionary parent, PdfName structureType, AccessibleElementId elementId)
PdfStructureElement(PdfStructureElement parent, PdfName structureType)
Creates a new instance of PdfStructureElement.PdfStructureElement(PdfStructureTreeRoot root, PdfName structureType)
Creates a new instance of PdfStructureElement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
colorsEqual(PdfArray parentColor, float[] color)
PdfObject
getAttribute(PdfName name)
Gets the first entarance of attribute.protected AccessibleElementId
getElementId()
PdfDictionary
getParent()
Gets the parent of this node.PdfDictionary
getParent(boolean includeStructTreeRoot)
private PdfObject
getParentAttribute(IPdfStructureElement parent, PdfName name)
PdfIndirectReference
getReference()
Gets the reference this object will be written to.PdfName
getStructureType()
private void
init(PdfDictionary parent, PdfName structureType)
(package private) void
setAnnotation(PdfAnnotation annot, PdfIndirectReference currentPage)
void
setAttribute(PdfName name, PdfObject obj)
Sets the attribute value.private void
setColorAttribute(BaseColor newColor, PdfObject oldColor, PdfName attributeName)
(package private) void
setPageMark(int page, int mark)
protected void
setStructureElementParent(PdfStructureElement parent)
protected void
setStructureTreeRoot(PdfStructureTreeRoot root)
private void
setTextAlignAttribute(int elementAlign)
void
toPdf(PdfWriter writer, java.io.OutputStream os)
Writes the PDF representation of thisPdfDictionary
as an array ofbyte
to the givenOutputStream
.private void
writeAttributes(Chunk chunk)
private void
writeAttributes(Document document)
private void
writeAttributes(Image image)
private void
writeAttributes(List list)
private void
writeAttributes(ListBody listBody)
private void
writeAttributes(ListItem listItem)
private void
writeAttributes(ListLabel listLabel)
private void
writeAttributes(Paragraph paragraph)
void
writeAttributes(IAccessibleElement element)
private void
writeAttributes(PdfDiv div)
private void
writeAttributes(PdfPCell cell)
private void
writeAttributes(PdfPHeaderCell headerCell)
private void
writeAttributes(PdfPRow row)
private void
writeAttributes(PdfPTable table)
private void
writeAttributes(PdfPTableBody body)
private void
writeAttributes(PdfPTableFooter footer)
private void
writeAttributes(PdfPTableHeader header)
private void
writeAttributes(PdfTemplate template)
-
Methods inherited from class com.itextpdf.text.pdf.PdfDictionary
checkType, clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toString
-
Methods inherited from class com.itextpdf.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
-
-
-
Field Detail
-
parent
private transient PdfStructureElement parent
Holds value of property kids.
-
top
private transient PdfStructureTreeRoot top
-
elementId
private AccessibleElementId elementId
-
reference
private PdfIndirectReference reference
Holds value of property reference.
-
structureType
private PdfName structureType
-
-
Constructor Detail
-
PdfStructureElement
public PdfStructureElement(PdfStructureElement parent, PdfName structureType)
Creates a new instance of PdfStructureElement.- Parameters:
parent
- the parent of this nodestructureType
- the type of structure. It may be a standard type or a user type mapped by the role map
-
PdfStructureElement
public PdfStructureElement(PdfStructureTreeRoot root, PdfName structureType)
Creates a new instance of PdfStructureElement.- Parameters:
root
- the parent of this nodestructureType
- the type of structure. It may be a standard type or a user type mapped by the role map
-
PdfStructureElement
protected PdfStructureElement(PdfDictionary parent, PdfName structureType, AccessibleElementId elementId)
-
-
Method Detail
-
getStructureType
public PdfName getStructureType()
-
init
private void init(PdfDictionary parent, PdfName structureType)
-
getParent
public PdfDictionary getParent()
Gets the parent of this node.- Returns:
- the parent of this node
-
getParent
public PdfDictionary getParent(boolean includeStructTreeRoot)
-
setPageMark
void setPageMark(int page, int mark)
-
setAnnotation
void setAnnotation(PdfAnnotation annot, PdfIndirectReference currentPage)
-
getReference
public PdfIndirectReference getReference()
Gets the reference this object will be written to.- Returns:
- the reference this object will be written to
- Since:
- 2.1.6 method removed in 2.1.5, but restored in 2.1.6
-
getAttribute
public PdfObject getAttribute(PdfName name)
Gets the first entarance of attribute.- Specified by:
getAttribute
in interfaceIPdfStructureElement
- Since:
- 5.3.4
-
setAttribute
public void setAttribute(PdfName name, PdfObject obj)
Sets the attribute value.- Specified by:
setAttribute
in interfaceIPdfStructureElement
- Since:
- 5.3.4
-
writeAttributes
public void writeAttributes(IAccessibleElement element)
-
writeAttributes
private void writeAttributes(Chunk chunk)
-
writeAttributes
private void writeAttributes(Image image)
-
writeAttributes
private void writeAttributes(PdfTemplate template)
-
writeAttributes
private void writeAttributes(Paragraph paragraph)
-
writeAttributes
private void writeAttributes(List list)
-
writeAttributes
private void writeAttributes(ListItem listItem)
-
writeAttributes
private void writeAttributes(ListBody listBody)
-
writeAttributes
private void writeAttributes(ListLabel listLabel)
-
writeAttributes
private void writeAttributes(PdfPTable table)
-
writeAttributes
private void writeAttributes(PdfPRow row)
-
writeAttributes
private void writeAttributes(PdfPCell cell)
-
writeAttributes
private void writeAttributes(PdfPHeaderCell headerCell)
-
writeAttributes
private void writeAttributes(PdfPTableHeader header)
-
writeAttributes
private void writeAttributes(PdfPTableBody body)
-
writeAttributes
private void writeAttributes(PdfPTableFooter footer)
-
writeAttributes
private void writeAttributes(PdfDiv div)
-
writeAttributes
private void writeAttributes(Document document)
-
colorsEqual
private boolean colorsEqual(PdfArray parentColor, float[] color)
-
setColorAttribute
private void setColorAttribute(BaseColor newColor, PdfObject oldColor, PdfName attributeName)
-
setTextAlignAttribute
private void setTextAlignAttribute(int elementAlign)
-
toPdf
public void toPdf(PdfWriter writer, java.io.OutputStream os) throws java.io.IOException
Description copied from class:PdfDictionary
Writes the PDF representation of thisPdfDictionary
as an array ofbyte
to the givenOutputStream
.- Overrides:
toPdf
in classPdfDictionary
- Parameters:
writer
- for backwards compatibilityos
- theOutputStream
to write the bytes to.- Throws:
java.io.IOException
-
getParentAttribute
private PdfObject getParentAttribute(IPdfStructureElement parent, PdfName name)
-
setStructureTreeRoot
protected void setStructureTreeRoot(PdfStructureTreeRoot root)
-
setStructureElementParent
protected void setStructureElementParent(PdfStructureElement parent)
-
getElementId
protected AccessibleElementId getElementId()
-
-