public class CanvasTag extends Object
In Tagged PDF, a tag is the basic structure unit for marking content. The tag
structure and hierarchy is largely comparable to HTML. As in HTML, every tag
type has a name, defined here in the role attribute. The tagging
mechanism in Tagged PDF is extensible, so PDF creators can choose to create
custom tags.
| Modifier and Type | Field and Description |
|---|---|
protected PdfDictionary |
properties
The properties of the tag.
|
protected PdfName |
role
The type of the tag.
|
| Constructor and Description |
|---|
CanvasTag(PdfMcr mcr)
Creates a tag that is referenced to the document's tag structure (i.e.
|
CanvasTag(PdfName role)
Creates a tag that is referenced to the document's tag structure (i.e.
|
CanvasTag(PdfName role,
int mcid)
Creates a tag that is referenced to the document's tag structure (i.e.
|
| Modifier and Type | Method and Description |
|---|---|
CanvasTag |
addProperty(PdfName name,
PdfObject value)
Adds a single property to the
tag's properties. |
String |
getActualText() |
String |
getExpansionText() |
int |
getMcid()
Get the marked content id of the tag.
|
PdfDictionary |
getProperties()
Get the properties of the tag.
|
PdfObject |
getProperty(PdfName name)
Gets a property from the
tag's properties dictionary. |
PdfName |
getRole()
Get the role of the tag.
|
boolean |
hasMcid()
Determine if an MCID is available
|
CanvasTag |
removeProperty(PdfName name)
Removes a single property from the
tag's properties. |
CanvasTag |
setProperties(PdfDictionary properties)
Sets a dictionary of properties to the
tag's properties. |
protected PdfName role
protected PdfDictionary properties
public CanvasTag(PdfName role)
role - the type of tagpublic CanvasTag(PdfName role, int mcid)
role - the type of tagmcid - marked content id which serves as a reference to the document's logical structurepublic CanvasTag(PdfMcr mcr)
mcr - the Marked Content Reference wrapper objectpublic PdfName getRole()
public int getMcid()
IllegalStateException - if there is no MCIDpublic boolean hasMcid()
public CanvasTag setProperties(PdfDictionary properties)
tag's properties. All existing properties (if any) will be lost.properties - a dictionaryCanvasTagpublic CanvasTag addProperty(PdfName name, PdfObject value)
tag's properties.name - a keyvalue - the value for the keyCanvasTagpublic CanvasTag removeProperty(PdfName name)
tag's properties.name - the key of the key-value pair to be removedCanvasTagpublic PdfObject getProperty(PdfName name)
tag's properties dictionary.name - the key of the key-value pair to be retrievedpublic PdfDictionary getProperties()
public String getActualText()
public String getExpansionText()
Copyright © 1998–2019 iText Group NV. All rights reserved.