Click or drag to resize
Pdf Library for .NET

WebElementPdfRectangle Class

Represents the rectangle occupied by a HTML element in a page of the generated PDF document. Obtained from PdfRectangles; an element that spans several pages produces one rectangle per page.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalWebElementPdfRectangle

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

The WebElementPdfRectangle type exposes the following members.

Properties
 NameDescription
Public propertyPageIndex The zero based index of the PDF page containing this rectangle.
Public propertyRectangle The rectangle position inside the PDF page drawing area. The drawing area of the PDF page does not include the page margins, header or footer. The rectangle dimensions are expressed in points (1 point is 1/72 inch).
Top
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.WebElementsMappingOptions.CssSelectors = new string[] { "h1" };
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
WebElement element = converter.Options.WebElementsMappingOptions.Result[0];
WebElementPdfRectangle rect = element.PdfRectangles[0];
System.Console.WriteLine("Page " + rect.PageIndex + ": " + rect.Rectangle);
doc.Close();
See Also