Class HtmlToPdfConverter
Class which allows converting HTML to PDF.
Inheritance
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public class HtmlToPdfConverter : Object
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; htmlConverter.ConverterSettings = webKitSettings; //Convert url to pdf PdfDocument document = htmlConverter.Convert("http://www.google.com"); MemoryStream stream = new MemoryStream(); document.Save(stream);
Constructors
HtmlToPdfConverter()
Initializes a new instance of the HtmlToPdfConverter class.
Declaration
public HtmlToPdfConverter()
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Convert url to pdf PdfDocument document = htmlConverter.Convert("http://www.google.com"); MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
HtmlToPdfConverter(HtmlRenderingEngine)
Initializes a new instance of the HtmlToPdfConverter class with specified RenderingEngine.
Declaration
public HtmlToPdfConverter(HtmlRenderingEngine renderingEngine)
Parameters
Type | Name | Description |
---|---|---|
HtmlRenderingEngine | renderingEngine | Rendering Engine used for conversion |
Remarks
To know more details about HTML to PDF converter, refer this link.
Examples
//Initialize the HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //Initialize the WebKit converter settings WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKit path settings.WebKitPath = @"/QtBinaries/"; //Assign WebKit settings to the HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save and close the PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
Properties
ConverterSettings
Gets or sets the rendering engine settings.
Declaration
public IHtmlConverterSettings ConverterSettings { get; set; }
Property Value
Type | Description |
---|---|
IHtmlConverterSettings | Specifies rendering engine settings. |
RenderingEngine
Gets or sets the rendering engine used for conversion.
Declaration
public HtmlRenderingEngine RenderingEngine { get; set; }
Property Value
Type | Description |
---|---|
HtmlRenderingEngine | Specifies rendering engine (By default, WebKit rendering engine). |
Examples
//Initialize the HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Set rendering engine for conversion htmlConverter.RenderingEngine = HtmlRenderingEngine.WebKit; //Initialize the WebKit converter settings WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKitPath settings.WebKitPath = "/QtBinaries/"; //Assign WebKit settings to the HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save and close the PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
ReuseBrowserProcess
Gets or sets a value indicating whether browser process reuse is enabled. Browser process reuse can improve conversion performance by keeping the underlying browser process running between conversions.
Declaration
public bool ReuseBrowserProcess { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
The chromium process will be running in background after every conversion. Should explicitly close the HtmlToPdfConverter, if this property is enabled.
Methods
Close()
Closes the browser process after conversions are completed.
Declaration
public void Close()
Remarks
Should explicitly close the HtmlToPdfConverter, if ReuseBrowserProcess property in enabled.
Convert(String)
Converts URL to PdfDocument.
Declaration
public PdfDocument Convert(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the HTML resource. |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set webkitSettings to the html converter htmlConverter.ConverterSettings = webKitSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
Convert(String, out PdfLayoutResult)
Converts URL to PdfDocument with layout result.
Declaration
public PdfDocument Convert(string url, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the HTML resource. |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set webkitSettings to the html converter htmlConverter.ConverterSettings = webKitSettings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert URL to PDF and get PDF layout result PdfDocument document = htmlConverter.Convert("https://www.google.com", out pdfLayoutResult); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
Convert(String, String)
Converts HTML string to PdfDocument
Declaration
public PdfDocument Convert(string html, string baseurl)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
Returns
Type | Description |
---|---|
PdfDocument | PDF document |
Examples
//Input HTML string string htmlString = "
Welcome to Syncfusion.!
Simple HTML content
"; //Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set WebKit settings to the converter htmlConverter.ConverterSettings = webKitSettings; //Convert HTML string to pdf PdfDocument document = htmlConverter.Convert(htmlString, ""); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);See Also
Convert(String, String, out PdfLayoutResult)
Converts HTML string to PdfDocument with layout result.
Declaration
public PdfDocument Convert(string html, string baseurl, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
PdfDocument | PDF document |
Examples
//Input HTML string string htmlString = "
Welcome to Syncfusion.!
Simple HTML content
"; //Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set WebKit settings to the converter htmlConverter.ConverterSettings = webKitSettings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert HTML string to pdf and get the Layout result PdfDocument document = htmlConverter.Convert(htmlString, "", out pdfLayoutResult); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);See Also
ConvertPartialHtml(String, String)
Converts URL to partial PdfDocument
Declaration
public PdfDocument ConvertPartialHtml(string url, string htmlElementID)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the HTML resource. |
System.String | htmlElementID | Used to convert particular part of a HTML page to PDF |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set WebKit settings to the converter htmlConverter.ConverterSettings = webKitSettings; //Convert partial HTML to PDF using HTML element ID PdfDocument document = htmlConverter.ConvertPartialHtml("http://www.google.com", "lga"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
ConvertPartialHtml(String, String, out PdfLayoutResult)
Converts URL to partial PdfDocument
Declaration
public PdfDocument ConvertPartialHtml(string url, string htmlElementID, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the HTML resource. |
System.String | htmlElementID | Used to convert particular part of a HTML page to PDF |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKitPath webKitSettings.WebKitPath = "QtBinaries"; //Set WebKit settings to the converter htmlConverter.ConverterSettings = webKitSettings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert partial HTML to PDF using HTML element ID PdfDocument document = htmlConverter.ConvertPartialHtml("http://www.google.com", "lga", out pdfLayoutResult); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
ConvertPartialHtml(String, String, String)
Converts HTML string to partial Pdfdocument.
Declaration
public PdfDocument ConvertPartialHtml(string html, string baseurl, string htmlElementID)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
System.String | htmlElementID | Used to convert particular part of a HTML page to PDF |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; //Set WebKit path settings.WebKitPath = @"/QtBinaries/"; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert partial HTML string to PDF using HTML element ID PdfDocument document = htmlConverter.ConvertPartialHtml(htmlText, baseUrl, "pic"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);See Also
ConvertPartialHtml(String, String, String, out PdfLayoutResult)
Converts HTML string to partial PdfDocument.
Declaration
public PdfDocument ConvertPartialHtml(string html, string baseurl, string htmlElementID, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
System.String | htmlElementID | Used to convert particular part of a HTML page to PDF |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
PdfDocument | The PDF document |
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; //Set WebKit path settings.WebKitPath = @"/QtBinaries/"; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert HTML string to PDF and get PDF layout result PdfDocument document = htmlConverter.ConvertPartialHtml(htmlText, baseUrl, "pic", out pdfLayoutResult); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);See Also
ConvertPartialHtmlToImage(String, String)
Converts URL to Partial Image
Declaration
public Image ConvertPartialHtmlToImage(string url, string htmlElementID)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the Html resource. |
System.String | htmlElementID | Used to convert particular part of a HTML page to image |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Remarks
To know more details about partial HTML to Image conversion, refer this link.
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Convert Partial HTML to Image Image image = htmlConverter.ConvertPartialHtmlToImage("input.html", "pic"); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);
See Also
ConvertPartialHtmlToImage(String, String, out PdfLayoutResult)
Converts URL to Partial Image
Declaration
public Image ConvertPartialHtmlToImage(string url, string htmlElementID, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the Html resource. |
System.String | htmlElementID | Used to convert particular part of a HTML page to image |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Remarks
To know more details about partial HTML to Image conversion, refer this link.
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert Partial HTML to Image using HTML element ID Image image = htmlConverter.ConvertPartialHtmlToImage("input.html", "pic", out pdfLayoutResult); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);
See Also
ConvertPartialHtmlToImage(String, String, String)
Converts HTML string to Partial Image.
Declaration
public Image ConvertPartialHtmlToImage(string html, string baseurl, string htmlElementID)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
System.String | htmlElementID | Used to convert particular part of a HTML page to image |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Remarks
To know more details about partial HTML to Image conversion, refer this link.
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Convert Partial HTML to Image Image image = htmlConverter.ConvertPartialHtmlToImage(htmlText, baseUrl, "pic"); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);See Also
ConvertPartialHtmlToImage(String, String, String, out PdfLayoutResult)
Converts HTML string to Partial Image.
Declaration
public Image ConvertPartialHtmlToImage(string html, string baseurl, string htmlElementID, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
System.String | htmlElementID | Used to convert particular part of a HTML page to image |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Remarks
To know more details about partial HTML to Image conversion, refer this link.
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert Partial HTML to Image with Element ID Image image = htmlConverter.ConvertPartialHtmlToImage(htmlText, baseUrl, "pic", pdfLayoutResult); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);See Also
ConvertPartialHtmlToSvg(String, String, Stream)
Converts an URL or local file to SVG and writes the converted SVG into a stream.
Declaration
public void ConvertPartialHtmlToSvg(string url, string htmlElementID, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL or local file path of the HTML document to convert to SVG. |
System.String | htmlElementID | Used to convert particular part of a HTML page to SVG |
System.IO.Stream | stream | The stream of the converted SVG file. |
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; Stream stream = new MemoryStream(); //Convert Partial HTML to SVG htmlConverter.ConvertPartialHtmlToSvg("https://www.google.com", "lga", stream); using (System.IO.FileStream output = new System.IO.FileStream(@"C:\MyOutput.svg", FileMode.Create)) { stream.CopyTo(output); } stream.Dispose();
ConvertToImage(String)
Converts URL to Image
Declaration
public Image ConvertToImage(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the Html resource. |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Convert HTML to Image Image image = htmlConverter.ConvertToImage("http://www.google.com"); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);
See Also
ConvertToImage(String, out PdfLayoutResult)
Converts URL to Image
Declaration
public Image ConvertToImage(string url, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Path to the Html resource. |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert HTML to Image Image image = htmlConverter.ConvertToImage("http://www.google.com", out pdfLayoutResult); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);
See Also
ConvertToImage(String, String)
Converts HTML string to Image
Declaration
public Image ConvertToImage(string html, string baseurl)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; //Convert HTML to Image Image image = htmlConverter.ConvertToImage(htmlText, baseUrl); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);See Also
ConvertToImage(String, String, out PdfLayoutResult)
Converts HTML string to Image
Declaration
public Image ConvertToImage(string html, string baseurl, out PdfLayoutResult layout)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | html string |
System.String | baseurl | Path of the resource used in the HTML |
PdfLayoutResult | layout | Layout result |
Returns
Type | Description |
---|---|
System.Drawing.Image | Image |
Examples
//Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //HTML string and Base URL string htmlText = "
Hello World
"; string baseUrl = @"C:/Temp/HTMLFiles/"; // WebKit converter settings WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Assign the WebKit binaries path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign the WebKit settings htmlConverter.ConverterSettings = webKitSettings; Initialize PDF layout result PdfLayoutResult pdfLayoutResult = null; //Convert HTML to Image Image image = htmlConverter.ConvertToImage(htmlText, baseUrl, out pdfLayoutResult); //Save Image File.WriteAllBytes("output.jpg", image.ImageData);See Also
ConvertToSvg(String, Stream)
Converts an URL or local file to SVG and writes the converted SVG into a stream.
Declaration
public void ConvertToSvg(string url, Stream outputStream)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL or local file path of the HTML document to convert to SVG. |
System.IO.Stream | outputStream | The stream of the converted SVG file. |
Examples
//Initialize HTML converter with WebKit rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKit path webKitSettings.WebKitPath = @"/QtBinaries/"; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = webKitSettings; Stream stream = new MemoryStream(); //Convert URL to SVG htmlConverter.ConvertToSvg(url, stream); using (System.IO.FileStream output = new System.IO.FileStream(@"C:\MyOutput.svg", FileMode.Create)) { stream.CopyTo(output); } stream.Dispose();
See Also
GetHtmlBounds(String)
Calculates and retrieves the dimensions (width and height) of the HTML content based on the current settings, such as viewport width and scale.
Declaration
public RectangleF GetHtmlBounds(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL or local file path of the HTML document to get the HTML size value. |
Returns
Type |
---|
System.Drawing.RectangleF |
GetHtmlBounds(String, String)
Calculates and retrieves the dimensions (width and height) of the HTML content based on the current settings, such as viewport width and scale.
Declaration
public RectangleF GetHtmlBounds(string htmlString, string baseURL)
Parameters
Type | Name | Description |
---|---|---|
System.String | htmlString | |
System.String | baseURL |
Returns
Type |
---|
System.Drawing.RectangleF |