Class PdfStructTreeRoot
Represents a wrapper-class for structure tree root dictionary.
public class PdfStructTreeRoot : PdfObjectWrapper<PdfDictionary>, IStructureNode
- Inheritance
-
PdfStructTreeRoot
- Implements
- Inherited Members
Remarks
Represents a wrapper-class for structure tree root dictionary. See ISO-32000-1 "14.7.2 Structure hierarchy".
Constructors
PdfStructTreeRoot(PdfDictionary, PdfDocument)
Creates wrapper instance for already existing logical structure tree root in the document.
public PdfStructTreeRoot(PdfDictionary structTreeRootDict, PdfDocument document)
Parameters
structTreeRootDict
PdfDictionarya dictionary that defines document structure tree root
document
PdfDocumenta document, which contains given structure tree root dictionary
Remarks
Creates wrapper instance for already existing logical structure tree root in the document. This class also handles global state of parent tree, so it's not expected to create multiple instances of this class. Instead, use GetStructTreeRoot().
PdfStructTreeRoot(PdfDocument)
Creates a new structure tree root instance, this initializes empty logical structure in the document.
public PdfStructTreeRoot(PdfDocument document)
Parameters
document
PdfDocumenta document to which new instance of struct tree root will be bound
Remarks
Creates a new structure tree root instance, this initializes empty logical structure in the document. This class also handles global state of parent tree, so it's not expected to create multiple instances of this class. Instead, use GetStructTreeRoot().
Methods
AddAssociatedFile(string, PdfFileSpec)
Adds file associated with structure tree root and identifies the relationship between them.
public virtual void AddAssociatedFile(string description, PdfFileSpec fs)
Parameters
description
stringthe file description
fs
PdfFileSpecfile specification dictionary of associated file
Remarks
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. 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 keyAddAssociatedFile(PdfFileSpec)
public virtual void AddAssociatedFile(PdfFileSpec fs)
Parameters
fs
PdfFileSpecfile specification dictionary of associated file
Remarks
AddKid(int, PdfStructElem)
public virtual PdfStructElem AddKid(int index, PdfStructElem structElem)
Parameters
index
intstructElem
PdfStructElem
Returns
AddKid(PdfStructElem)
public virtual PdfStructElem AddKid(PdfStructElem structElem)
Parameters
structElem
PdfStructElem
Returns
AddNamespace(PdfNamespace)
Adds a PdfNamespace to the list of the namespaces used within the document.
public virtual void AddNamespace(PdfNamespace @namespace)
Parameters
namespace
PdfNamespacea PdfNamespace to be added.
Remarks
Adds a 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.AddPronunciationLexicon(PdfFileSpec)
Adds a single PdfFileSpec object, which specifies XML file conforming to PLS.
public virtual void AddPronunciationLexicon(PdfFileSpec pronunciationLexiconFileSpec)
Parameters
pronunciationLexiconFileSpec
PdfFileSpeca PdfFileSpec object, which specifies XML file conforming to PLS.
Remarks
Adds a single 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.AddRoleMapping(string, string)
public virtual void AddRoleMapping(string fromRole, string toRole)
Parameters
ConvertRoleToPdfName(string)
public static PdfName ConvertRoleToPdfName(string role)
Parameters
role
string
Returns
CopyTo(PdfDocument, IDictionary<PdfPage, PdfPage>)
Copies structure to a
destDocument
.
public virtual void CopyTo(PdfDocument destDocument, IDictionary<PdfPage, PdfPage> page2page)
Parameters
destDocument
PdfDocumentdocument to copy structure to. Shall not be current document.
page2page
IDictionary<PdfPage, PdfPage>association between original page and copied page.
Remarks
Copies structure to a
destDocument
.
NOTE: Works only for
PdfStructTreeRoot
that is read from the document opened in reading mode,
otherwise an exception is thrown.
CopyTo(PdfDocument, int, IDictionary<PdfPage, PdfPage>)
Copies structure to a
destDocument
and insert it in a specified position in the document.
public virtual void CopyTo(PdfDocument destDocument, int insertBeforePage, IDictionary<PdfPage, PdfPage> page2page)
Parameters
destDocument
PdfDocumentdocument to copy structure to.
insertBeforePage
intindicates where the structure to be inserted.
page2page
IDictionary<PdfPage, PdfPage>association between original page and copied page.
Remarks
Copies structure to a
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.
CreateParentTreeEntryForPage(PdfPage)
Creates and flushes parent tree entry for the page.
public virtual void CreateParentTreeEntryForPage(PdfPage page)
Parameters
page
PdfPagePdfPage for which to create parent tree entry. Typically this page is flushed after this call.
Remarks
Creates and flushes parent tree entry for the page. Effectively this means that new content mustn't be added to the page.
FindMcrByMcid(PdfDictionary, int)
public virtual PdfMcr FindMcrByMcid(PdfDictionary pageDict, int mcid)
Parameters
pageDict
PdfDictionarymcid
int
Returns
FindMcrByMcid(PdfDocument, int)
public virtual PdfMcr FindMcrByMcid(PdfDocument document, int mcid)
Parameters
document
PdfDocumentmcid
int
Returns
FindObjRefByStructParentIndex(PdfDictionary, int)
public virtual PdfObjRef FindObjRefByStructParentIndex(PdfDictionary pageDict, int structParentIndex)
Parameters
pageDict
PdfDictionarystructParentIndex
int
Returns
Flush()
public override void Flush()
GetAssociatedFiles(bool)
Returns files associated with structure tree root.
public virtual PdfArray GetAssociatedFiles(bool create)
Parameters
create
booldefines whether AF arrays will be created if it doesn't exist
Returns
- PdfArray
associated files array
GetDocument()
public virtual PdfDocument GetDocument()
Returns
GetIdTree()
Returns the document's structure element ID tree wrapped in a PdfStructIdTree object.
public virtual PdfStructIdTree GetIdTree()
Returns
- PdfStructIdTree
the PdfStructIdTree of the document
Remarks
Returns the document's structure element ID tree wrapped in a PdfStructIdTree object. If no such tree exists, it is initialized. The initialization happens lazily, and does not trigger any PDF object changes unless populated.
GetKids()
Gets list of the direct kids of StructTreeRoot.
public virtual IList<IStructureNode> GetKids()
Returns
- IList<IStructureNode>
list of the direct kids of StructTreeRoot.
Remarks
Gets list of the direct kids of StructTreeRoot. If certain kid is flushed, there will be a null in the list on it's place.
GetKidsObject()
public virtual PdfArray GetKidsObject()
Returns
GetNamespaces()
Gets namespaces used within the document.
public virtual IList<PdfNamespace> GetNamespaces()
Returns
- IList<PdfNamespace>
a
of PdfNamespace s used within the document.
Remarks
Gets namespaces used within the document. Essentially this method returns value of
GetNamespacesObject()
wrapped in the
PdfNamespace
and
GetNamespacesObject()
An array of namespaces used within the document.
public virtual PdfArray GetNamespacesObject()
Returns
Remarks
An array of namespaces used within the document. This value, however, is not automatically updated while the document is processed. It identifies only the namespaces that were in the document at the moment of it's opening.
GetNextMcidForPage(PdfPage)
public virtual int GetNextMcidForPage(PdfPage page)
Parameters
page
PdfPage
Returns
GetPageMarkedContentReferences(PdfPage)
Gets an unmodifiable collection of marked content references on page.
public virtual ICollection<PdfMcr> GetPageMarkedContentReferences(PdfPage page)
Parameters
Returns
- ICollection<PdfMcr>
the unmodifiable collection of marked content references on page, if no Mcrs defined returns null
Remarks
Gets an unmodifiable collection of marked content references on page. NOTE: Do not remove tags when iterating over returned collection, this could lead to the ConcurrentModificationException, because returned collection is backed by the internal list of the actual page tags.
GetParent()
public virtual IStructureNode GetParent()
Returns
GetParentTreeNextKey()
public virtual int GetParentTreeNextKey()
Returns
GetPronunciationLexiconsList()
A
public virtual IList<PdfFileSpec> GetPronunciationLexiconsList()
Returns
- IList<PdfFileSpec>
A
containing one or more PdfFileSpec.
Remarks
A
GetRole()
public virtual PdfName GetRole()
Returns
GetRoleMap()
public virtual PdfDictionary GetRoleMap()
Returns
IsWrappedObjectMustBeIndirect()
protected override bool IsWrappedObjectMustBeIndirect()
Returns
Move(PdfPage, int)
Moves structure associated with specified page and insert it in a specified position in the document.
public virtual void Move(PdfPage fromPage, int insertBeforePage)
Parameters
fromPage
PdfPagepage which tag structure will be moved
insertBeforePage
intindicates before tags of which page tag structure will be moved to
Remarks
Moves structure associated with specified page and insert it in a specified position in the document.
NOTE: Works only for document with not flushed pages.SavePageStructParentIndexIfNeeded(PdfPage)
public virtual void SavePageStructParentIndexIfNeeded(PdfPage page)
Parameters
page
PdfPage