[]
        
(Showing Draft Content)

GrapeCity.Documents.Html.HtmlPage

Class HtmlPage

Namespace
GrapeCity.Documents.Html
Assembly
GcDocs.Html.dll

Represents a page in a GcHtmlBrowser instance.

public class HtmlPage : IDisposable
Inheritance
object
HtmlPage
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Properties

Browser

Gets the owner GcHtmlBrowser.

public GcHtmlBrowser Browser { get; }

Property Value

GcHtmlBrowser

TimeoutOptions

Gets the timeout settings for various browser operations.

public TimeoutOptions TimeoutOptions { get; }

Property Value

TimeoutOptions

Methods

Dispose()

Clean up any resources being used.

public void Dispose()

EvaluateExpression<T>(string)

Executes a script in the browser context.

public T EvaluateExpression<T>(string script)

Parameters

script string

Script to be evaluated in browser context.

Returns

T

Script return value.

Type Parameters

T

The type to deserialize the result to.

~HtmlPage()

Performs cleanup operations on unmanaged resources.

protected ~HtmlPage()

GetContent()

Gets the full HTML content of the page, including the doctype.

public string GetContent()

Returns

string

GetContentSize()

Gets the size of page scrollable area, in pixels.

public Size GetContentSize()

Returns

System.Drawing.Size

GetTitle()

Gets the page title.

public string GetTitle()

Returns

string

GetWindowSize()

Gets the virtual window size, in pixels.

public Size GetWindowSize()

Returns

System.Drawing.Size

Reload(PageLoadStates)

Reloads the page.

public void Reload(PageLoadStates waitUntil = PageLoadStates.Load)

Parameters

waitUntil PageLoadStates

When to consider navigation succeeded.

Render(GcBitmap, PngOptions)

Renders the current page to an existing GcBitmap.

public void Render(GcBitmap bitmap, PngOptions options = null)

Parameters

bitmap GcBitmap

The destination GcBitmap. Note that its current content will be lost.

options PngOptions

The set of parameters for the output image.

RenderAndCrop(GcBitmap, PngOptions, Color?, int, int, int, int)

Renders the current page to an existing GcBitmap and crops.

public void RenderAndCrop(GcBitmap bitmap, PngOptions options = null, Color? backColor = null, int leftMargin = 0, int topMargin = 0, int rightMargin = 0, int bottomMargin = 0)

Parameters

bitmap GcBitmap

The destination GcBitmap. Note that its current content will be lost.

options PngOptions

The set of parameters for the output image.

backColor System.Drawing.Color?

The color to be treated as the background to crop. If not set, the color of the bottom right pixel of the image is taken as the background.

leftMargin int

The width of the left margin, in pixels.

topMargin int

The height of the top margin, in pixels.

rightMargin int

The width of the right margin, in pixels.

bottomMargin int

The height of the bottom margin, in pixels.

ResetDefaultBackgroundColor()

Clears an override of the default background color.

public void ResetDefaultBackgroundColor()

SaveAsJpeg(Stream, JpegOptions)

Saves the current page to a stream in JPEG format.

public void SaveAsJpeg(Stream outputStream, JpegOptions options = null)

Parameters

outputStream System.IO.Stream

The destination stream.

options JpegOptions

The set of parameters for the output JPEG image.

SaveAsJpeg(string, JpegOptions)

Saves the current web page as a JPEG image file.

public void SaveAsJpeg(string outputFilePath, JpegOptions options = null)

Parameters

outputFilePath string

The destination file path.

options JpegOptions

The set of parameters for the output JPEG image.

SaveAsPdf(Stream, PdfOptions)

Saves the current page to a stream in PDF format.

public void SaveAsPdf(Stream outputStream, PdfOptions options = null)

Parameters

outputStream System.IO.Stream

The destination stream.

options PdfOptions

The set of parameters for the output PDF document.

SaveAsPdf(string, PdfOptions)

Creates a PDF file from the current page.

public void SaveAsPdf(string outputFilePath, PdfOptions options = null)

Parameters

outputFilePath string

The destination file path.

options PdfOptions

The set of parameters for the output PDF file.

SaveAsPng(Stream, PngOptions)

Saves the current page to a stream in PNG format.

public void SaveAsPng(Stream outputStream, PngOptions options = null)

Parameters

outputStream System.IO.Stream

The destination stream.

options PngOptions

The set of parameters for the output PNG image.

SaveAsPng(string, PngOptions)

Saves the current page as a PNG image file.

public void SaveAsPng(string outputFilePath, PngOptions options = null)

Parameters

outputFilePath string

The destination file path.

options PngOptions

The set of parameters for the output PNG image.

SaveAsWebp(Stream, WebpOptions)

Saves the current page to a stream in WEBP format.

public void SaveAsWebp(Stream outputStream, WebpOptions options = null)

Parameters

outputStream System.IO.Stream

The destination stream.

options WebpOptions

The set of parameters for the output WEBP image.

SaveAsWebp(string, WebpOptions)

Saves the current page as a WEBP image file.

public void SaveAsWebp(string outputFilePath, WebpOptions options = null)

Parameters

outputFilePath string

The destination file path.

options WebpOptions

The set of parameters for the output WEBP image.

SetContent(string, PageLoadStates)

Sets the HTML markup to the page.

public void SetContent(string html, PageLoadStates waitUntil = PageLoadStates.Load)

Parameters

html string

HTML markup to assign to the page.

waitUntil PageLoadStates

When to consider navigation succeeded.

SetDefaultBackgroundColor(Color)

Sets the background color to be used if the HTML markup doesn't specify one.

public void SetDefaultBackgroundColor(Color color)

Parameters

color System.Drawing.Color

SetWindowSize(Size)

Sets the virtual window size, in pixels.

public void SetWindowSize(Size windowSize)

Parameters

windowSize System.Drawing.Size

ToJpegBytes(JpegOptions)

Renders the current page to an image in JPEG format and returns it as a byte array.

public byte[] ToJpegBytes(JpegOptions options = null)

Parameters

options JpegOptions

The set of parameters for the output JPEG image.

Returns

byte[]

The byte array with image data in JPEG format.

ToPdfBytes(PdfOptions)

Renders the current page to a PDF document and returns it as a byte array.

public byte[] ToPdfBytes(PdfOptions options = null)

Parameters

options PdfOptions

The set of parameters for the output PDF document.

Returns

byte[]

The byte array with a PDF document.

ToPngBytes(PngOptions)

Renders the current page to an image in PNG format and returns it as a byte array.

public byte[] ToPngBytes(PngOptions options = null)

Parameters

options PngOptions

The set of parameters for the output PNG image.

Returns

byte[]

The byte array with image data in PNG format.

ToWebpBytes(WebpOptions)

Renders the current page to an image in WEBP format and returns it as a byte array.

public byte[] ToWebpBytes(WebpOptions options = null)

Parameters

options WebpOptions

The set of parameters for the output WEBP image.

Returns

byte[]

The byte array with image data in WEBP format.

WaitForNetworkIdle(int, int)

Waits for network idle during the specified amount of time.

public void WaitForNetworkIdle(int idleTime = 500, int maxTimeout = 30000)

Parameters

idleTime int

How long to wait for no network requests, in milliseconds.

maxTimeout int

Maximum time to wait for, in milliseconds.