The following example shows the effect that this parameter has
on HTML rendering.
using var doc = new Doc();
doc.Rect.Inset(100, 100);
doc.Rect.Top = 700;
doc.HtmlOptions.Engine = EngineType.Chrome123;
doc.HtmlOptions.AddTags = true;
// The ABCGecko and MSHTML tagging format uses styles.
string html1 = "<!DOCTYPE html><html><head>" +
"<style type='text/css'>" +
".tag-visible { abcpdf-tag-visible:true; outline: 1px solid transparent; font-size: 72pt; }" +
"</style>" +
"</head><body>" +
"<p id='p1' class='tag-visible'>Gallia est omnis divisa in partes tres.</p>" +
"</body></html>";
// The ABCChrome tagging format uses attributes.
string html2 = "<!DOCTYPE html><html><head>" +
"<style type='text/css'>" +
"p { font-size: 72pt; }" +
"</style>" +
"</head><body>" +
"<p id='p1' abcpdf-tag-visible>Gallia est omnis divisa in partes tres.</p>" +
"</body></html>";
string html = doc.HtmlOptions.Engine != EngineType.Chrome123 ? html1 : html2;
int id = doc.AddImageHtml(html);
// Frame location of the tagged element
var tagRects = doc.HtmlOptions.GetTagRects(id);
foreach (var rect in tagRects) {
doc.Rect.String = rect.ToString();
doc.FrameRect();
}
// Output tag ID
var tagIds = doc.HtmlOptions.GetTagIDs(id);
doc.Rect.String = doc.MediaBox.String;
doc.Rect.Inset(20, 20);
doc.FontSize = 64;
doc.Color.String = "255 0 0";
doc.AddText($"Tag ID \"{tagIds[0]}\":");
// Save the document
doc.Save(Server.MapPath("HtmlOptionsGetTagRects.pdf"));
Using doc As New Doc()
doc.Rect.Inset(100, 100)
doc.Rect.Top = 700
doc.HtmlOptions.Engine = EngineType.Chrome123
doc.HtmlOptions.AddTags = True
' The ABCGecko and MSHTML tagging format uses styles.
Dim html1 As String = "<!DOCTYPE html><html><head>" + "<style type='text/css'>" + ".tag-visible { abcpdf-tag-visible:true; outline: 1px solid transparent; font-size: 72pt; }" + "</style>" + "</head><body>" + "<p id='p1' class='tag-visible'>Gallia est omnis divisa in partes tres.</p>" + "</body></html>"
' The ABCChrome tagging format uses attributes.
Dim html2 As String = "<!DOCTYPE html><html><head>" + "<style type='text/css'>" + "p { font-size: 72pt; }" + "</style>" + "</head><body>" + "<p id='p1' abcpdf-tag-visible>Gallia est omnis divisa in partes tres.</p>" + "</body></html>"
Dim html As String = If(doc.HtmlOptions.Engine <> EngineType.Chrome123, html1, html2)
Dim id As Integer = doc.AddImageHtml(html)
' Frame location of the tagged element
Dim tagRects As XRect() = doc.HtmlOptions.GetTagRects(id)
For Each theRect As XRect In tagRects
doc.Rect.String = theRect.ToString()
doc.FrameRect()
Next
' Output tag ID
Dim tagIds As String() = doc.HtmlOptions.GetTagIDs(id)
doc.Rect.String = doc.MediaBox.[String]
doc.Rect.Inset(20, 20)
doc.FontSize = 64
doc.Color.String = "255 0 0"
doc.AddText($"Tag ID ""{tagIds[0]}"":")
' Save the document
doc.Save(Server.MapPath("HtmlOptionsGetTagRects.pdf"))
End Using