public class TagStructureContext extends Object implements Serializable
TagStructureContext class is used to track necessary information of document's tag structure.
It is also used to make some global modifications of the tag tree like removing or flushing page tags, however
these two methods and also others are called automatically and are for the most part for internal usage.
PdfDocument. To obtain instance of this class use
PdfDocument.getTagStructureContext().| Modifier and Type | Field and Description |
|---|---|
protected TagTreePointer |
autoTaggingPointer |
| Constructor and Description |
|---|
TagStructureContext(PdfDocument document)
Do not use this constructor, instead use
PdfDocument.getTagStructureContext()
method. |
TagStructureContext(PdfDocument document,
PdfVersion tagStructureTargetVersion) |
| Modifier and Type | Method and Description |
|---|---|
void |
actualizeTagsProperties()
Method for internal usages.
|
TagStructureContext |
flushPageTags(PdfPage page)
Flushes the tags which are considered to belong to the given page.
|
TagTreePointer |
getAutoTaggingPointer()
All document auto tagging logic uses
TagTreePointer returned by this method to manipulate tag structure. |
PdfVersion |
getTagStructureTargetVersion() |
boolean |
isElementConnectedToTag(IAccessibleElement element)
Checks if given
IAccessibleElement is connected to some tag. |
TagStructureContext |
moveTagPointerToTag(IAccessibleElement element,
TagTreePointer tagPointer)
Sets the tag, which is connected with the given accessible element, as a current tag for the given
TagTreePointer. |
void |
normalizeDocumentRootTag()
Transforms root tags in a way that complies with the PDF References.
|
TagStructureContext |
removeAllConnectionsToTags()
Destroys all the retained connections.
|
TagTreePointer |
removeAnnotationTag(PdfAnnotation annotation)
Removes annotation content item from the tag structure.
|
TagTreePointer |
removeContentItem(PdfPage page,
int mcid)
Removes content item from the tag structure.
|
TagStructureContext |
removeElementConnectionToTag(IAccessibleElement element)
Destroys the connection between the given accessible element and the tag to which this element is connected to.
|
TagStructureContext |
removePageTags(PdfPage page)
Removes all tags that belong only to this page.
|
TagStructureContext |
setForbidUnknownRoles(boolean forbidUnknownRoles)
If forbidUnknownRoles is set to true, then if you would try to add new tag which has not a standard role and
it's role is not mapped through RoleMap, an exception will be raised.
|
protected TagTreePointer autoTaggingPointer
public TagStructureContext(PdfDocument document)
PdfDocument.getTagStructureContext()
method.
TagStructureContext for document. There shall be only one instance of this
class per PdfDocument.document - the document which tag structure will be manipulated with this class.public TagStructureContext(PdfDocument document, PdfVersion tagStructureTargetVersion)
public TagStructureContext setForbidUnknownRoles(boolean forbidUnknownRoles)
forbidUnknownRoles - new value of the flagTagStructureContext instance.public PdfVersion getTagStructureTargetVersion()
public TagTreePointer getAutoTaggingPointer()
TagTreePointer returned by this method to manipulate tag structure.
Typically it points at the root tag. This pointer also could be used to tweak auto tagging process
(e.g. move this pointer to the Sect tag, which would result in placing all automatically tagged content
under Sect tag).TagTreePointer which is used for all auto tagging of the document.public boolean isElementConnectedToTag(IAccessibleElement element)
IAccessibleElement is connected to some tag.element - element to check if it has a connected tag.public TagStructureContext removeElementConnectionToTag(IAccessibleElement element)
element - IAccessibleElement which connection to the tag (if there is one) will be removed.TagStructureContext instance.public TagTreePointer removeAnnotationTag(PdfAnnotation annotation)
TagTreePointer instance which points at annotation tag parent if annotation was removed,
otherwise returns null.public TagTreePointer removeContentItem(PdfPage page, int mcid)
page - page, which contains this content itemmcid - marked content id of this content itemTagTreePointer which points at the parent of the removed content item, or null if there is no
such mcid on given page.public TagStructureContext removePageTags(PdfPage page)
flushPageTags(PdfPage).page - page that defines which tags are to be removedTagStructureContext instance.public TagStructureContext moveTagPointerToTag(IAccessibleElement element, TagTreePointer tagPointer)
TagTreePointer. An exception will be thrown, if given accessible element is not connected to any tag.element - an element which has a connection with some tag.tagPointer - TagTreePointer which will be moved to the tag connected to the given accessible element.TagStructureContext instance.public TagStructureContext removeAllConnectionsToTags()
TagStructureContext instance.public TagStructureContext flushPageTags(PdfPage page)
page - a page which tags will be flushed.public void normalizeDocumentRootTag()
public void actualizeTagsProperties()
Copyright © 1998–2016 iText Group NV. All rights reserved.