Gets an array of the locations of tagged visible items.

 

   

Syntax
 

[C#]
XRect[] GetTagRects(int id)

[Visual Basic]
Function GetTagRects(id As Integer) As XRect()

 

   

Params
 
Name Description
id The Object ID of the object.
return The location of tagged visible HTML objects.

 

   

Notes
 

Use this method to retrieve the locations of tagged visible items. The locations are to be used with Doc.Transform being identity.

To use this method you need to enable the tagging functionality. See the AddTags property for details.

This function takes an ID obtained from a call to Doc.AddImageUrl, Doc.AddImageHtml or Doc.AddImageToChain and returns the locations of any items which are visible on the PDF page as a result of that call.

The locations match up directly on a one-to-one basis with the IDs returned by the GetTagIDs function.

 

   

Example
 

The following example shows the effect that this parameter has on HTML rendering.

[C#]
Doc theDoc = new Doc();
theDoc.Rect.Inset(100, 100);
theDoc.Rect.Top = 700;
// Tag elements with style 'abcpdf-tag-visible: true'
theDoc.HtmlOptions.AddTags = true;
int id = theDoc.AddImageHtml("<FONT id=\"p1\" style=\"abcpdf-tag-visible: true; font-size: 72pt\">Gallia est omnis divisa in partes tres.</FONT>");
// Frame location of the tagged element
XRect[] tagRects = theDoc.HtmlOptions.GetTagRects(id);
foreach (XRect theRect in tagRects) {
  theDoc.Rect.String = theRect.ToString();
  theDoc.FrameRect();
}
// Output tag ID
string[] tagIds = theDoc.HtmlOptions.GetTagIDs(id);
theDoc.Rect.String = theDoc.MediaBox.String;
theDoc.Rect.Inset(20, 20);
theDoc.FontSize = 64;
theDoc.Color.String = "255 0 0";
theDoc.AddText("Tag ID \"" + tagIds[0] +"\":") ;
// Save the document
theDoc.Save(Server.MapPath("HtmlOptionsGetTagRects.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.Inset(100, 100)
theDoc.Rect.Top = 700
' Tag elements with style 'abcpdf-tag-visible: true'
theDoc.HtmlOptions.AddTags = true
Dim id As Integer
id = theDoc.AddImageHtml("<FONT id=""p1"" style=""abcpdf-tag-visible: true; font-size: 72pt"">Gallia est omnis divisa in partes tres.</FONT>")
' Frame location of the tagged element
Dim tagRects As XRect()
tagRects = theDoc.HtmlOptions.GetTagRects(id)
Dim theRect As XRect
For Each theRect in tagRects
  theDoc.Rect.String = theRect.ToString()
  theDoc.FrameRect()
Next
' Output tag ID
Dim tagIds As String()
tagIds = theDoc.HtmlOptions.GetTagIDs(id)
theDoc.Rect.String = theDoc.MediaBox.String
theDoc.Rect.Inset(20, 20)
theDoc.FontSize = 64
theDoc.Color.String = "255 0 0"
theDoc.AddText("Tag ID """ + tagIds(0) +""":")
' Save the document
theDoc.Save(Server.MapPath("HtmlOptionsGetTagRects.pdf"))
theDoc.Clear()


HtmlOptionsGetTagRects.pdf