Class WebKitConverterSettings
Class which represents the settings of WebKit rendering engine
Inheritance
Implements
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public class WebKitConverterSettings : Object, IHtmlConverterSettings
Examples
//Initialize HtmlToPdfConverter with WebKitConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); WebKitConverterSettings webKitSettings = new WebKitConverterSettings(); //Set WebKit settings webKitSettings.WebKitPath = "QtBinaries"; webKitSettings.AdditionalDelay = 1000; webKitSettings.Cookies.Add("CookieName", "CookieValue"); webKitSettings.EnableBookmarks = true; webKitSettings.EnableForm = true; webKitSettings.EnableHyperLink = true; webKitSettings.EnableJavaScript = true; webKitSettings.EnableOfflineMode = false; webKitSettings.EnableRepeatTableHeader = true; webKitSettings.EnableRepeatTableFooter = true; webKitSettings.EnableToc = true; webKitSettings.HttpPostFields.Add("PostKey", "PostValue"); webKitSettings.HttpRequestHeaders.Add("HeaderKey", "HeaderValue"); webKitSettings.Margin.All = 10; webKitSettings.MediaType = MediaType.Print; webKitSettings.Orientation = PdfPageOrientation.Landscape; webKitSettings.PageRotateAngle = PdfPageRotateAngle.RotateAngle0; webKitSettings.Username = ""; webKitSettings.Password = ""; webKitSettings.PdfPageSize = new SizeF(200, 300); webKitSettings.SinglePageLayout = SinglePageLayout.None; webKitSettings.SplitImages = false; webKitSettings.SplitTextLines = false; webKitSettings.WebKitViewPort = new Size(1024, 0); webKitSettings.WindowStatus = ""; //Set WebKit settings to the converter htmlConverter.ConverterSettings = webKitSettings; //Convert partial HTML to PDF using HTML element ID PdfDocument document = htmlConverter.Convert("http://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Constructors
WebKitConverterSettings()
Initializes a new instance of the WebKitConverterSettings class.
Declaration
public WebKitConverterSettings()
Properties
AdditionalDelay
Gets or sets the additional delay to load JavaScript. Unit is Milliseconds.
Declaration
public int AdditionalDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | A integer value indicating to apply delay for loading scripts. Unit is Milliseconds; By default 0 |
BackgroundColor
Gets or sets a background color when converting a HTML document.
Declaration
public Color BackgroundColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Cookies
Gets or sets the cookie collection with their name and value.
Declaration
public CookieCollection Cookies { get; set; }
Property Value
Type | Description |
---|---|
CookieCollection | The cookies Collection |
See Also
DisableWebKitWarning
Sets a value that indicates whether to remove the WebKit engine warning or not. The default value is false.
Declaration
public bool DisableWebKitWarning { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableBookmarks
A property indicating if the automatic creation of bookmarks in PDF for the H1 to H6 HTML elements is enabled or not. By default the automatic bookmarks creation is disabled.
Declaration
public bool EnableBookmarks { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableForm
Gets or sets enable form; If it is enabled, then HTML form fields are converted to PDF form fields in the generated PDF document. By default, false.
Declaration
public bool EnableForm { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableHyperLink
Gets or sets a value indicating whether to preserve the live-links in the converted document;
Declaration
public bool EnableHyperLink { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the Hyperlinks are enabled, otherwise false. By default true. |
EnableJavaScript
Gets or sets a value indicating whether to enable or disable JavaScripts in the webpage.
Declaration
public bool EnableJavaScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if Javascript is enabled, otherwise,false. By default true |
EnableOfflineMode
Gets or sets the offline mode. By default, false.
Declaration
public bool EnableOfflineMode { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableRepeatTableFooter
Gets or sets the repetition of table footer. By enabling this property, will repeat the table footer on every page break. The default value is false.
Declaration
public bool EnableRepeatTableFooter { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableRepeatTableHeader
Gets or sets the repetition of table header. By enabling this property, will repeat the table header on every page break. The default value is false.
Declaration
public bool EnableRepeatTableHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableToc
A property indicating if the automatic creation of a table of contents items for the H1 to H6 HTML elements is enabled or not. By default this property is false.
Declaration
public bool EnableToc { get; set; }
Property Value
Type |
---|
System.Boolean |
HtmlEncoding
Gets or sets Encoding for HTML string to PDF conversion.
Declaration
public Encoding HtmlEncoding { get; set; }
Property Value
Type |
---|
System.Text.Encoding |
Remarks
This property will not have any effect on URL to PDF conversion
HttpPostFields
Gets or sets the HTTP post collection fields.
Declaration
public HttpPostFieldCollection HttpPostFields { get; set; }
Property Value
Type |
---|
HttpPostFieldCollection |
Remarks
Presence of elements in this collection will initiate Post request or else it will proceed with Get request.
HttpRequestHeaders
Gets or sets the HTTP Request headers.
Declaration
public HttpRequestHeaderCollection HttpRequestHeaders { get; set; }
Property Value
Type |
---|
HttpRequestHeaderCollection |
Margin
Gets or sets the margins to the a document.
Declaration
public PdfMargins Margin { get; set; }
Property Value
Type | Description |
---|---|
PdfMargins | The PdfMargins, provides margins to the PDF page. By default , PDF margin is 0. |
MediaType
Gets or sets the media type of WebKit HTML converter
Declaration
public MediaType MediaType { get; set; }
Property Value
Type |
---|
MediaType |
Orientation
Gets or sets the orientation of a PDF document.
Declaration
public PdfPageOrientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
PdfPageOrientation | The PdfPageOrientation, provides the orientation of the PDF page.By default Portrait |
PageRotateAngle
Gets or sets the number of degrees by which the page should be rotated clockwise when displayed or printed.
Declaration
public PdfPageRotateAngle PageRotateAngle { get; set; }
Property Value
Type | Description |
---|---|
PdfPageRotateAngle | The PdfPageRotateAngle,provides number of degrees by which the page should be rotated clockwise when displayed or printed |
Remarks
Default value: RotateAngle0
Password
Gets or sets the password.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the password of web page. By default empty |
PdfFooter
Gets or sets the Footer to a PDF document.
Declaration
public PdfPageTemplateElement PdfFooter { get; set; }
Property Value
Type | Description |
---|---|
PdfPageTemplateElement | The PdfPageTemplateElement to draw into the PDF page. By default null |
PdfHeader
Gets or sets the Header to a PDF document.
Declaration
public PdfPageTemplateElement PdfHeader { get; set; }
Property Value
Type | Description |
---|---|
PdfPageTemplateElement | The PdfPageTemplateElement to draw into the PDF page. By default null |
PdfPageSize
Gets or sets the size of a PDF page.
Declaration
public SizeF PdfPageSize { get; set; }
Property Value
Type |
---|
System.Drawing.SizeF |
Remarks
Default value: 595 * 842 pixels (A4 size)
ProxySettings
Gets or sets the proxy server settings for WebKit HTML conversion
Declaration
public WebKitProxySettings ProxySettings { get; set; }
Property Value
Type |
---|
WebKitProxySettings |
SinglePageLayout
Use this option to render the whole HTML content into single PDF page
Declaration
public SinglePageLayout SinglePageLayout { get; set; }
Property Value
Type |
---|
SinglePageLayout |
SplitImages
Gets or sets the SplitImages property for splitting the images.
Declaration
public bool SplitImages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
SplitTextLines
Get or sets the SplitTextLines property for splitting the lines.
Declaration
public bool SplitTextLines { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
TempPath
Gets or sets the temporary path where the temporary operations are performed if any.
Declaration
public string TempPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Temp path which used to create internal files for conversion. By default %temp% |
Toc
Gets or sets Toc styles.
Declaration
public HtmlToPdfToc Toc { get; set; }
Property Value
Type |
---|
HtmlToPdfToc |
TocPageCount
Gets the table of content page count.
Declaration
public int TocPageCount { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); //Initialize WebKitConverter settings WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKit path settings.WebKitPath = "/QtBinaries/"; //Set enable toc settings.EnableToc = true; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Get Toc Page Count int tocPageCount = settings.TocPageCount; //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Username
Gets or sets the username.
Declaration
public string Username { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the username of web page. By default empty |
WebKitPath
Gets or sets the WebKit binaries path.
Declaration
public string WebKitPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies WebKit assemblies path. By default bin folder |
WebKitViewPort
Gets or sets the WebKit view port size.
Declaration
public Size WebKitViewPort { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Size | By default 1024x0 ViewPort size |
WindowStatus
Gets or sets the window status.
Declaration
public string WindowStatus { get; set; }
Property Value
Type |
---|
System.String |