Table of Contents

Class CanvasTag

Namespace
iText.Kernel.Pdf.Canvas
Assembly
itext.kernel.dll

This class represents a single tag on a single piece of marked content.

public class CanvasTag
Inheritance
CanvasTag
Derived
Inherited Members

Remarks

This class represents a single tag on a single piece of marked content.

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.

Constructors

CanvasTag(PdfName)

Creates a tag that is referenced to the document's tag structure (i.e. logical structure).

public CanvasTag(PdfName role)

Parameters

role PdfName

the type of tag

CanvasTag(PdfName, int)

Creates a tag that is referenced to the document's tag structure (i.e. logical structure).

public CanvasTag(PdfName role, int mcid)

Parameters

role PdfName

the type of tag

mcid int

marked content id which serves as a reference to the document's logical structure

CanvasTag(PdfMcr)

Creates a tag that is referenced to the document's tag structure (i.e. logical structure).

public CanvasTag(PdfMcr mcr)

Parameters

mcr PdfMcr

the Marked Content Reference wrapper object

Fields

properties

The properties of the tag.

protected PdfDictionary properties

Field Value

PdfDictionary

role

The type of the tag.

protected PdfName role

Field Value

PdfName

Methods

AddProperty(PdfName, PdfObject)

Adds a single property to the tag 's properties.

public virtual CanvasTag AddProperty(PdfName name, PdfObject value)

Parameters

name PdfName

a key

value PdfObject

the value for the key

Returns

CanvasTag

current CanvasTag

GetActualText()

Gets value of /ActualText property.

public virtual string GetActualText()

Returns

string

actual text value or null if actual text is not defined

GetExpansionText()

public virtual string GetExpansionText()

Returns

string

GetMcid()

Get the marked content id of the tag.

public virtual int GetMcid()

Returns

int

marked content id

GetProperties()

Get the properties of the tag.

public virtual PdfDictionary GetProperties()

Returns

PdfDictionary

properties of the tag

GetProperty(PdfName)

Gets a property from the tag 's properties dictionary.

public virtual PdfObject GetProperty(PdfName name)

Parameters

name PdfName

the key of the key-value pair to be retrieved

Returns

PdfObject

the value corresponding to the key

GetRole()

Get the role of the tag.

public virtual PdfName GetRole()

Returns

PdfName

the role of the tag as a PdfName

HasMcid()

Determine if an MCID is available

public virtual bool HasMcid()

Returns

bool

true if the MCID is available, false otherwise

RemoveProperty(PdfName)

Removes a single property from the tag 's properties.

public virtual CanvasTag RemoveProperty(PdfName name)

Parameters

name PdfName

the key of the key-value pair to be removed

Returns

CanvasTag

current CanvasTag

SetProperties(PdfDictionary)

Sets a dictionary of properties to the tag 's properties.

public virtual CanvasTag SetProperties(PdfDictionary properties)

Parameters

properties PdfDictionary

a dictionary

Returns

CanvasTag

current CanvasTag

Remarks

Sets a dictionary of properties to the tag 's properties. All existing properties (if any) will be lost.