public class PdfStructTreeRoot extends PdfObjectWrapper<PdfDictionary> implements IStructureNode
Constructor and Description |
---|
PdfStructTreeRoot(PdfDictionary structTreeRootDict, PdfDocument document)
Creates wrapper instance for already existing logical structure tree root in the document.
|
PdfStructTreeRoot(PdfDocument document)
Creates a new structure tree root instance, this initializes empty logical structure in the document.
|
Modifier and Type | Method and Description |
---|---|
void |
addAssociatedFile(PdfFileSpec fs)
Adds file associated with structure tree root and identifies the relationship between them.
|
void |
addAssociatedFile(String description, PdfFileSpec fs)
Adds file associated with structure tree root and identifies the relationship between them.
|
PdfStructElem |
addKid(int index, PdfStructElem structElem) |
PdfStructElem |
addKid(PdfStructElem structElem) |
void |
addNamespace(PdfNamespace namespace)
Adds a PdfNamespace to the list of the namespaces used within the document.
|
void |
addPronunciationLexicon(PdfFileSpec pronunciationLexiconFileSpec)
Adds a single PdfFileSpec object, which specifies XML file conforming to PLS.
|
void |
addRoleMapping(String fromRole, String toRole) |
static PdfName |
convertRoleToPdfName(String role) |
void |
copyTo(PdfDocument destDocument, int insertBeforePage, Map<PdfPage,PdfPage> page2page)
Copies structure to a destDocument and insert it in a specified position in the document.
|
void |
copyTo(PdfDocument destDocument, Map<PdfPage,PdfPage> page2page)
Copies structure to a destDocument .
|
void |
createParentTreeEntryForPage(PdfPage page)
Creates and flushes parent tree entry for the page.
|
PdfMcr |
findMcrByMcid(PdfDictionary pageDict, int mcid) |
PdfObjRef |
findObjRefByStructParentIndex(PdfDictionary pageDict, int structParentIndex) |
void |
flush() |
PdfArray |
getAssociatedFiles(boolean create)
Returns files associated with structure tree root.
|
PdfDocument |
getDocument() |
List<IStructureNode> |
getKids()
Gets list of the direct kids of StructTreeRoot.
|
PdfArray |
getKidsObject() |
List<PdfNamespace> |
getNamespaces()
Gets namespaces used within the document.
|
PdfArray |
getNamespacesObject()
An array of namespaces used within the document.
|
int |
getNextMcidForPage(PdfPage page) |
Collection<PdfMcr> |
getPageMarkedContentReferences(PdfPage page)
Gets an unmodifiable collection of marked content references on page.
|
IStructureNode |
getParent() |
int |
getParentTreeNextKey() |
List<PdfFileSpec> |
getPronunciationLexiconsList()
A List containing one or more PdfFileSpec objects, where each specified file is a pronunciation lexicon, which is an XML file conforming to the Pronunciation Lexicon Specification (PLS) Version 1.0.
|
PdfName |
getRole() |
PdfDictionary |
getRoleMap() |
protected boolean |
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.
|
void |
move(PdfPage fromPage, int insertBeforePage)
Moves structure associated with specified page and insert it in a specified position in the document.
|
void |
savePageStructParentIndexIfNeeded(PdfPage page) |
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
public PdfStructTreeRoot(PdfDocument document)
PdfDocument.getStructTreeRoot()
.
document
- a document to which new instance of struct tree root will be bound
public PdfStructTreeRoot(PdfDictionary structTreeRootDict, PdfDocument document)
PdfDocument.getStructTreeRoot()
.
structTreeRootDict
- a dictionary that defines document structure tree root
document
- a document, which contains given structure tree root dictionary
public PdfStructElem addKid(PdfStructElem structElem)
public PdfStructElem addKid(int index, PdfStructElem structElem)
public IStructureNode getParent()
getParent
in interface IStructureNode
public List<IStructureNode> getKids()
null
in the list on it's place.
getKids
in interface IStructureNode
public PdfArray getKidsObject()
public PdfDictionary getRoleMap()
public List<PdfNamespace> getNamespaces()
getNamespacesObject()
wrapped in the PdfNamespace
and List
classes. Therefore limitations of the referred method are applied to this method too.
List
of PdfNamespace
s used within the document.
public void addNamespace(PdfNamespace namespace)
PdfNamespace
to the list of the namespaces used within the document.
This value has meaning only for the PDF documents of version 2.0 and higher.
namespace
- a PdfNamespace
to be added.
public PdfArray getNamespacesObject()
PdfArray
of namespaces used within the document.
public List<PdfFileSpec> getPronunciationLexiconsList()
List
containing one or more PdfFileSpec
objects, where each specified file is a pronunciation lexicon, which is an XML file conforming to the Pronunciation Lexicon Specification (PLS) Version 1.0. These pronunciation lexicons may be used as pronunciation hints when the document’s content is presented via text-to-speech. Where two or more pronunciation lexicons apply to the same text, the first match – as defined by the order of entries in the array and the order of entries inside the pronunciation lexicon file – should be used.
See ISO 32000-2 14.9.6, "Pronunciation hints".
List
containing one or more PdfFileSpec
.
public void addPronunciationLexicon(PdfFileSpec pronunciationLexiconFileSpec)
PdfFileSpec
object, which specifies XML file conforming to PLS. For more info see getPronunciationLexiconsList()
.
This value has meaning only for the PDF documents of version 2.0 and higher.
pronunciationLexiconFileSpec
- a PdfFileSpec
object, which specifies XML file conforming to PLS.
public void createParentTreeEntryForPage(PdfPage page)
page
- PdfPage
for which to create parent tree entry. Typically this page is flushed after this call.
public void savePageStructParentIndexIfNeeded(PdfPage page)
public Collection<PdfMcr> getPageMarkedContentReferences(PdfPage page)
page
- PdfPage
to obtain unmodifiable collection of marked content references
public PdfMcr findMcrByMcid(PdfDictionary pageDict, int mcid)
public PdfObjRef findObjRefByStructParentIndex(PdfDictionary pageDict, int structParentIndex)
public PdfName getRole()
getRole
in interface IStructureNode
public void flush()
flush
in class PdfObjectWrapper<PdfDictionary>
public void copyTo(PdfDocument destDocument, Map<PdfPage,PdfPage> page2page)
destDocument
. NOTE: Works only for PdfStructTreeRoot
that is read from the document opened in reading mode, otherwise an exception is thrown.
destDocument
- document to copy structure to. Shall not be current document.
page2page
- association between original page and copied page.
public void copyTo(PdfDocument destDocument, int insertBeforePage, Map<PdfPage,PdfPage> page2page)
destDocument
and insert it in a specified position in the document. NOTE: Works only for PdfStructTreeRoot
that is read from the document opened in reading mode, otherwise an exception is thrown.
destDocument
- document to copy structure to.
insertBeforePage
- indicates where the structure to be inserted.
page2page
- association between original page and copied page.
public void move(PdfPage fromPage, int insertBeforePage)
NOTE: Works only for document with not flushed pages.
fromPage
- page which tag structure will be moved
insertBeforePage
- indicates before tags of which page tag structure will be moved to
public int getParentTreeNextKey()
public int getNextMcidForPage(PdfPage page)
public PdfDocument getDocument()
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 tree root 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 tree root 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 tree root 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
- defines whether AF arrays will be created if it doesn't exist
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect
in class PdfObjectWrapper<PdfDictionary>
Copyright © 1998–2022 iText Group NV. All rights reserved.