Click or drag to resize
Pdf Library for .NET

WebElementsCollection Class

A read-only collection of WebElement mappings produced by the conversion, one per HTML element matched by the mapping selectors. Obtained from Result; enumerate it, index into it, or look up an element by its HTML id or tag name.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalWebElementsCollection

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class WebElementsCollection : IEnumerable

The WebElementsCollection type exposes the following members.

Constructors
 NameDescription
Public methodWebElementsCollection 
Top
Properties
 NameDescription
Public propertyCount Gets the number of mappings in the collection.
Public propertyItem Gets the mapping at the specified zero based index from the collection.
Top
Methods
 NameDescription
Public methodGetElementByHtmlId Gets the mapping in PDF of the HTML element with the specified HTML ID. The search is case insensitive.
Public methodGetElementsByTagName Gets the mappings in PDF of the HTML elements with the specified HTML tag name. The search is case insensitive.
Public methodGetEnumerator Returns an enumerator that iterates through the WebElement mappings in the collection.
Top
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.WebElementsMappingOptions.CssSelectors = new string[] { "h1" };
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
WebElementsCollection elements =
    converter.Options.WebElementsMappingOptions.Result;
System.Console.WriteLine("Mapped elements: " + elements.Count);
doc.Close();
See Also