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 tag
public CanvasTag(PdfName role, int mcid)
role
- the type of tag
mcid
- marked content id which serves as a reference to the document's logical structure
public CanvasTag(PdfMcr mcr)
mcr
- the Marked Content Reference
wrapper object
public PdfName getRole()
public int getMcid()
IllegalStateException
- if there is no MCID
public boolean hasMcid()
public CanvasTag setProperties(PdfDictionary properties)
tag
's properties. All existing properties (if any) will be lost.
properties
- a dictionary
CanvasTag
public CanvasTag addProperty(PdfName name, PdfObject value)
tag
's properties.
name
- a key
value
- the value for the key
CanvasTag
public CanvasTag removeProperty(PdfName name)
tag
's properties.
name
- the key of the key-value pair to be removed
CanvasTag
public PdfObject getProperty(PdfName name)
tag
's properties dictionary.
name
- the key of the key-value pair to be retrieved
public PdfDictionary getProperties()
public String getActualText()
public String getExpansionText()
Copyright © 1998–2018 iText Group NV. All rights reserved.