public class PdfStructElem extends PdfObjectWrapper<PdfDictionary> implements IStructureNode
The logical structure of a document shall be described by a hierarchy of objects called the structure hierarchy or structure tree. At the root of the hierarchy shall be a dictionary object called the structure tree root (see PdfStructTreeRoot
). Immediate children of the structure tree root are structure elements. Structure elements are other structure elements or content items.
Constructor and Description |
---|
PdfStructElem(PdfDictionary pdfObject) |
PdfStructElem(PdfDocument document, PdfName role) |
PdfStructElem(PdfDocument document, PdfName role, PdfAnnotation annot) |
PdfStructElem(PdfDocument document, PdfName role, PdfPage page) |
Modifier and Type | Method and Description |
---|---|
void |
addAssociatedFile(PdfFileSpec fs)
Adds file associated with structure element and identifies the relationship between them.
|
void |
addAssociatedFile(String description, PdfFileSpec fs)
Adds file associated with structure element and identifies the relationship between them.
|
PdfMcr |
addKid(int index, PdfMcr kid) |
PdfStructElem |
addKid(int index, PdfStructElem kid) |
PdfMcr |
addKid(PdfMcr kid) |
PdfStructElem |
addKid(PdfStructElem kid) |
void |
addRef(PdfStructElem ref)
A PdfName.Ref identifies the structure element to which the item of content, contained within this structure element, refers (e.g.
|
void |
flush() |
PdfString |
getActualText() |
PdfString |
getAlt() |
PdfArray |
getAssociatedFiles(boolean create)
Returns files associated with structure element.
|
PdfObject |
getAttributes(boolean createNewIfNull)
Gets attributes object.
|
protected PdfDocument |
getDocument() |
PdfString |
getE() |
PdfObject |
getK() |
List<IStructureNode> |
getKids()
Gets list of the direct kids of structure element.
|
PdfString |
getLang() |
PdfNamespace |
getNamespace()
A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").
|
IStructureNode |
getParent() |
PdfString |
getPhoneme()
Attribute for a structure element that may be used as pronunciation hint.
|
PdfName |
getPhoneticAlphabet()
Attribute for a structure element that indicates the phonetic alphabet used by a PdfName.Phoneme attribute.
|
List<PdfStructElem> |
getRefsList()
A PdfName.Ref identifies the structure element or elements to which the item of content, contained within this structure element, refers (e.g.
|
PdfName |
getRole() |
static boolean |
isStructElem(PdfDictionary dictionary)
Method to to distinguish struct elements from other elements of the logical tree (like mcr or struct tree root).
|
protected boolean |
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.
|
PdfStructElem |
put(PdfName key, PdfObject value) |
IStructureNode |
removeKid(int index) |
IStructureNode |
removeKid(int index, boolean prepareForReAdding) |
int |
removeKid(IStructureNode kid) |
void |
setActualText(PdfString actualText) |
void |
setAlt(PdfString alt) |
void |
setAttributes(PdfObject attributes) |
void |
setE(PdfString e) |
void |
setLang(PdfString lang) |
void |
setNamespace(PdfNamespace namespace)
A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").
|
void |
setPhoneme(PdfString elementPhoneme)
Attribute for a structure element that may be used as pronunciation hint.
|
void |
setPhoneticAlphabet(PdfName phoneticAlphabet)
Attribute for a structure element that indicates the phonetic alphabet used by a PdfName.Phoneme attribute.
|
void |
setRole(PdfName role) |
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
public PdfStructElem(PdfDictionary pdfObject)
public PdfStructElem(PdfDocument document, PdfName role, PdfPage page)
public PdfStructElem(PdfDocument document, PdfName role, PdfAnnotation annot)
public PdfStructElem(PdfDocument document, PdfName role)
public static boolean isStructElem(PdfDictionary dictionary)
public PdfObject getAttributes(boolean createNewIfNull)
createNewIfNull
- sometimes attributes object may not exist. Pass true
if you want to create empty dictionary in such case. The attributes dictionary will be stored inside element.
public void setAttributes(PdfObject attributes)
public PdfString getLang()
public void setLang(PdfString lang)
public PdfString getAlt()
public void setAlt(PdfString alt)
public PdfString getActualText()
public void setActualText(PdfString actualText)
public PdfString getE()
public void setE(PdfString e)
public PdfName getRole()
getRole
in interface IStructureNode
public void setRole(PdfName role)
public PdfStructElem addKid(PdfStructElem kid)
public PdfStructElem addKid(int index, PdfStructElem kid)
public IStructureNode removeKid(int index)
public IStructureNode removeKid(int index, boolean prepareForReAdding)
public int removeKid(IStructureNode kid)
public IStructureNode getParent()
getParent
in interface IStructureNode
public List<IStructureNode> getKids()
null
in the list on it's place.
getKids
in interface IStructureNode
public PdfObject getK()
public List<PdfStructElem> getRefsList()
PdfName.Ref
identifies the structure element or elements to which the item of content, contained within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).
List
<PdfStructElem
> containing zero, one or more structure elements.
public void addRef(PdfStructElem ref)
PdfName.Ref
identifies the structure element to which the item of content, contained within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).
This value has meaning only for the PDF documents of version 2.0 and higher.
ref
- a PdfStructElem
to which the item of content, contained within this structure element, refers.
public PdfNamespace getNamespace()
PdfNamespace
this element belongs to.
public void setNamespace(PdfNamespace namespace)
This value has meaning only for the PDF documents of version 2.0 and higher.
namespace
- a PdfNamespace
this element belongs to, or null if element is desired to be considered in the default standard structure namespace.
public void setPhoneme(PdfString elementPhoneme)
This value has meaning only for the PDF documents of version 2.0 and higher.
elementPhoneme
- a PdfString
which defines an exact replacement for content enclosed by the structure element and its children. This value is to be interpreted based on the PhoneticAlphabet attribute in effect.
public PdfString getPhoneme()
PdfString
which defines an exact replacement for content enclosed by the structure element and its children. This value is to be interpreted based on the PhoneticAlphabet attribute in effect.
public void setPhoneticAlphabet(PdfName phoneticAlphabet)
PdfName.Phoneme
attribute. Applies to the structure element and its children, except where overridden by a child structure element.
This value has meaning only for the PDF documents of version 2.0 and higher.
phoneticAlphabet
- the PdfName
which defines phonetic alphabet used by a PdfName.Phoneme
attribute. Possible values are:
PdfName.ipa
for the International Phonetic Alphabet by the International Phonetic Association; PdfName.x_sampa
for Extended Speech Assessment Methods Phonetic Alphabet (X-SAMPA); PdfName.zh_Latn_pinyin
for Pinyin Latin romanization (Mandarin); PdfName.zh_Latn_wadegile
for Wade-Giles romanization (Mandarin). public PdfName getPhoneticAlphabet()
PdfName.Phoneme
attribute. Applies to the structure element and its children, except where overridden by a child structure element.
PdfName
which defines phonetic alphabet used by a PdfName.Phoneme
, or null if not defined, default value PdfName.ipa
. See setPhoneticAlphabet(PdfName)
for other possible values.
public void addAssociatedFile(String description, PdfFileSpec fs)
Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the structure element dictionary. If description is provided, it also will add file description to catalog Names tree.
For associated files their associated file specification dictionaries shall include the AFRelationship key
description
- the file description
fs
- file specification dictionary of associated file
public void addAssociatedFile(PdfFileSpec fs)
Adds file associated with structure element and identifies the relationship between them.
Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the structure element dictionary.
For associated files their associated file specification dictionaries shall include the AFRelationship key
fs
- file specification dictionary of associated file
public PdfArray getAssociatedFiles(boolean create)
create
- iText will create AF array if it doesn't exist and create value is true
public PdfStructElem put(PdfName key, PdfObject value)
public void flush()
flush
in class PdfObjectWrapper<PdfDictionary>
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect
in class PdfObjectWrapper<PdfDictionary>
protected PdfDocument getDocument()
Copyright © 1998–2020 iText Group NV. All rights reserved.