[]
        
(Showing Draft Content)

GrapeCity.Documents.Html.GcHtmlRenderer

Class GcHtmlRenderer

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

Provides methods for converting HTML to PDF and images.

This class is deprecated as of GcHtml v6.0.0. While old code that uses this and related classes will continue to work, it is recommended to switch to using the new GcHtmlBrowser class instead. For information on how to convert existing code please see documentation at https://www.grapecity.com/documents-api-pdf/docs/online/render_html_to_pdf.html and https://www.grapecity.com/documents-api-imaging/docs/online/render_html_to_image.html.

Note that the 3 platform-specific packages (GrapeCity.Documents.Html.Windows.X64, GrapeCity.Documents.Html.Linux.X64 and GrapeCity.Documents.Html.Mac.X64) are no longer needed and should be removed from your projects even if you do not convert your code to using GcHtmlBrowser.
[Obsolete("Use GcHtmlBrowser class instead.")]
public class GcHtmlRenderer : IDisposable
Inheritance
object
GcHtmlRenderer
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

GcHtmlRenderer(string)

Initializes a new instance of GcHtmlRenderer from HTML string.

public GcHtmlRenderer(string html)

Parameters

html string

The HTML string to render.

GcHtmlRenderer(Uri)

Initializes a new instance of GcHtmlRenderer from System.Uri.

public GcHtmlRenderer(Uri htmlUri)

Parameters

htmlUri System.Uri

The URI specifying the source HTML page.

Fields

LastLogMessage

Gets the last log message from the headless Chromium shell.

[ThreadStatic]
public static string LastLogMessage

Field Value

string

Properties

AuthServerWhitelist

Gets or sets a whitelist to passthrough Windows authentication for the specified domains.

For example: "*example.com,*foobar.com,*baz".

public string AuthServerWhitelist { get; set; }

Property Value

string

BrowserDestinationFolder

Gets or sets the destination folder for the Chromium downloads.

If this property is not set, the downloads are stored to [root]/.local-chromium, where [root] is where the project binaries are located.

public static string BrowserDestinationFolder { get; set; }

Property Value

string

IsDisposed

Gets a value indicating whether the GcHtmlRenderer has been disposed of.

public bool IsDisposed { get; }

Property Value

bool

IsSupported

Gets a value indicating if GcHtmlRenderer is available on the current platform.

public static bool IsSupported { get; }

Property Value

bool

PathToGcHtmlToPdf

Gets or sets the optional path to Chrome, Edge, or Chromium executable to run.

public static string PathToGcHtmlToPdf { get; set; }

Property Value

string

ProxyServer

Gets or sets a proxy server, overrides system settings. Affects HTTP and HTTPS requests only.

For example: "https://proxy-ip:proxy-port" or "socks5://127.0.0.1:1080".

public string ProxyServer { get; set; }

Property Value

string

VirtualTimeBudget

Gets or sets the number of milliseconds to wait before deeming the page to be ready.

Setting this property to a value greater than 0, activates LoadLazyImages mode.

public int VirtualTimeBudget { get; set; }

Property Value

int

WaitDuration

Gets or sets the maximum navigation time, in milliseconds.

Defaults to 180000 ms.

public static int WaitDuration { get; set; }

Property Value

int

WebSocketFactory

Gets or sets the optional factory for System.Net.WebSockets.WebSocket implementations.

For more information, see comments to WebSocketFactory.

public static WebSocketFactory WebSocketFactory { get; set; }

Property Value

WebSocketFactory

Methods

ApplyGcImagingLicenseKey(string)

Applies a GcImaging license key to use by the current instance of GcHtmlRenderer.

Up to five images can be created without a license.

public void ApplyGcImagingLicenseKey(string key)

Parameters

key string

The GcImaging license key to apply.

See Also

ApplyGcPdfLicenseKey(string)

Applies a GcPdf license key to use by the current instance of GcHtmlRenderer.

Up to five PDFs can be created without a license.

public void ApplyGcPdfLicenseKey(string key)

Parameters

key string

The GcPdf license key to apply.

See Also

Dispose()

Clean up any resources being used.

public void Dispose()

Dispose(bool)

Performs cleanup operations on managed and unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~GcHtmlRenderer()

Performs cleanup operations on unmanaged resources.

protected ~GcHtmlRenderer()

RenderToGcBitmap(GcBitmap, HtmlToImageFormat)

Renders the source HTML to an existing GcBitmap.

public bool RenderToGcBitmap(GcBitmap bitmap, HtmlToImageFormat format = null)

Parameters

bitmap GcBitmap

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

format HtmlToImageFormat

The formatting attributes.

Returns

bool

True if HTML was successfully rendered; otherwise, false.

RenderToJpeg(Stream, JpegSettings)

Creates a JPEG image from the source HTML and saves it to a specified stream.

public bool RenderToJpeg(Stream outputStream, JpegSettings settings = null)

Parameters

outputStream System.IO.Stream

The destination stream.

settings JpegSettings

The set of parameters for the output image.

Returns

bool

True if JPEG was successfully saved; otherwise, false.

RenderToJpeg(string, JpegSettings)

Creates a JPEG image file from the source HTML.

public bool RenderToJpeg(string outputFilePath, JpegSettings settings = null)

Parameters

outputFilePath string

The destination file path.

settings JpegSettings

The set of parameters for the output image.

Returns

bool

True if the browser process has exited; otherwise, false.

RenderToPdf(Stream, PdfSettings)

Creates a PDF document from the source HTML and saves it to a specified stream.

public bool RenderToPdf(Stream outputStream, PdfSettings settings = null)

Parameters

outputStream System.IO.Stream

The destination stream.

settings PdfSettings

The set of parameters for the output PDF.

Returns

bool

True if PDF was successfully saved; otherwise, false.

RenderToPdf(string, PdfSettings)

Creates a PDF file from the source HTML.

public bool RenderToPdf(string outputFilePath, PdfSettings settings = null)

Parameters

outputFilePath string

The destination file path.

settings PdfSettings

The set of parameters for the output PDF file.

Returns

bool

True if the browser process has exited; otherwise, false.

RenderToPng(Stream, PngSettings)

Creates a PNG image from the source HTML and saves it to a specified stream.

public bool RenderToPng(Stream outputStream, PngSettings settings = null)

Parameters

outputStream System.IO.Stream

The destination stream.

settings PngSettings

The set of parameters for the output image.

Returns

bool

True if PNG was successfully saved; otherwise, false.

RenderToPng(string, PngSettings)

Creates a PNG image file from the source HTML.

public bool RenderToPng(string outputFilePath, PngSettings settings = null)

Parameters

outputFilePath string

The destination file path.

settings PngSettings

The set of parameters for the output image.

Returns

bool

True if the browser process has exited; otherwise, false.

SetGcImagingLicenseKey(string)

Sets a GcImaging license key to use by all instances of GcHtmlRenderer.

Up to five images can be created without a license.

public static void SetGcImagingLicenseKey(string key)

Parameters

key string

The GcImaging license key to set.

See Also

SetGcPdfLicenseKey(string)

Sets a GcPdf license key to use by all instances of GcHtmlRenderer.

Up to five PDFs can be created without a license.

public static void SetGcPdfLicenseKey(string key)

Parameters

key string

The GcPdf license key to set.

See Also