WebKitConverterSettings Class
Class which represents the settings of WebKit rendering engine
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public class WebKitConverterSettings : IHtmlConverterSettings
Examples
//Initialize HtmlToPdfConverter class with WebKit rendering Engine.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(RenderEngine.WebKit);
//Setting properties for WebKit conversion.
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
webKitSettings.AdditionalDelay = 1000;
webKitSettings.WebKitPath = @"/QtBinaries/";
webKitSettings.AspectRatio = AspectRatio.None;
webKitSettings.EnableHyperLink = true;
webKitSettings.EnableJavaScript = true;
webKitSettings.Margin = new PdfMargins { All = 40 };
webKitSettings.Orientation = PdfPageOrientation.Portrait;
webKitSettings.Password = "";
webKitSettings.Username = "";
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument pdfDocument = htmlConverter.Convert("http://www.google.com");
//Saving and closing PDF document
pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
'Initialize HtmlToPdfConverter class with WebKit rendering Engine.
Dim htmlConverter As New HtmlToPdfConverter(RenderEngine.WebKit)
'Setting properties for WebKit conversion.
Dim webKitSettings As New WebKitConverterSettings()
webKitSettings.AdditionalDelay = 1000
webKitSettings.WebKitPath = @"/QtBinaries/"
webKitSettings.AspectRatio = AspectRatio.None
webKitSettings.EnableHyperLink = True
webKitSettings.EnableJavaScript = True
webKitSettings.Orientation = PdfPageOrientation.Portrait
webKitSettings.Password = ""
webKitSettings.Username = ""
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim pdfDocument As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Saving and closing PDF document
pdfDocument.Save("Output.pdf")
pdfDocument.Close(True)
Constructors
WebKitConverterSettings()
Initializes a new instance of the WebKitConverterSettings class.
Declaration
public WebKitConverterSettings()
Examples
//Initialize HtmlToPdfConverter class with WebKit rendering Engine.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(RenderEngine.WebKit);
//Setting properties for WebKit conversion.
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
webKitSettings.AdditionalDelay = 1000;
webKitSettings.WebKitPath = @"/QtBinaries/";
webKitSettings.AspectRatio = AspectRatio.None;
webKitSettings.EnableHyperLink = true;
webKitSettings.EnableJavaScript = true;
webKitSettings.Margin = new PdfMargins { All = 40 };
webKitSettings.Orientation = PdfPageOrientation.Portrait;
webKitSettings.Password = "";
webKitSettings.Username = "";
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument pdfDocument = htmlConverter.Convert("http://www.google.com");
//Saving and closing PDF document
pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
'Initialize HtmlToPdfConverter class with WebKit rendering Engine.
Dim htmlConverter As New HtmlToPdfConverter(RenderEngine.WebKit)
'Setting properties for WebKit conversion.
Dim webKitSettings As New WebKitConverterSettings()
webKitSettings.AdditionalDelay = 1000
webKitSettings.WebKitPath = @"/QtBinaries/"
webKitSettings.AspectRatio = AspectRatio.None
webKitSettings.EnableHyperLink = True
webKitSettings.EnableJavaScript = True
webKitSettings.Orientation = PdfPageOrientation.Portrait
webKitSettings.Password = ""
webKitSettings.Username = ""
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim pdfDocument As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Saving and closing PDF document
pdfDocument.Save("Output.pdf")
pdfDocument.Close(True)
See Also
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 |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set additional delay; units in milliseconds;
webKitSettings.AdditionalDelay = 3000;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set additional delay; units in milliseconds;
webKitSettings.AdditionalDelay = 3000
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
AspectRatio
Gets or sets the aspect ratio;
Declaration
public AspectRatio AspectRatio { get; set; }
Property Value
Type | Description |
---|---|
AspectRatio | The AspectRatio By default None |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set AspectRatio
webKitSettings.AspectRatio = AspectRatio.None;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set AspectRatio
webKitSettings.AspectRatio = AspectRatio.None
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
BackgroundColor
Gets or sets a background color when converting a HTML document.
Declaration
public Color BackgroundColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Set background color for conversion.
settings.BackgroundColor = Color.Red;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim settings As WebKitConverterSettings = New WebKitConverterSettings
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Set background color for conversion.
settings.BackgroundColor = "Color.Red
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(true)
Cookies
Gets or sets cookie collection with names and values
Declaration
public CookieCollection Cookies { get; set; }
Property Value
Type | Description |
---|---|
CookieCollection | The cookies Collection |
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/";
// Add cookies as name and value pair
webKitSettings.Cookies.Add("CookieName1", " CookieValue1");
webKitSettings.Cookies.Add("CookieName2", " CookieValue2");
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert url to pdf
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Add cookies
webKitSettings.Cookies.Add("Name1", "Value1")
webKitSettings.Cookies.Add("Name2", "Value2")
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com ")
'Save and close the document
document.Save("Output.pdf")
document.Close()
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 { set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings settings = new WebKitConverterSettings();
//Disable WebKit warning message
settings.DisableWebKitWarning = true;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim settings As New WebKitConverterSettings()
'Disable WebKit warning message
settings.DisableWebKitWarning = True
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
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 |
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/";
// Enable bookmarks
webKitSettings.EnableBookmarks = true;
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable bookmarks
webKitSettings.EnableBookmarks = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the document
document.Save("Output.pdf")
document.Close()
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. The default value is false.
Declaration
public bool EnableForm { get; set; }
Property Value
Type |
---|
System.Boolean |
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/";
//Set enable form
webKitSettings.EnableForm = true;
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("http://asp.syncfusion.com/demos/http_post_get/default.aspx");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set enable form
webKitSettings.EnableForm = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://asp.syncfusion.com/demos/http_post_get/default.aspx")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close()
EnableHyperLink
Gets or Sets a value indicating whether to preserve the live-links in the converted document or not;
Declaration
public bool EnableHyperLink { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the Hyperlinks are enabled, otherwise false.Default is true |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Enable hyperlinks; By default - true
webKitSettings.EnableHyperLink = false;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable hyperlinks; By default - True
webKitSettings.EnableHyperLink = False
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
EnableJavaScript
Gets or Sets a value indicating whether to Enable/Disable JavaScripts in the webpage;
Declaration
public bool EnableJavaScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if Javascript is enabled, otherwise,false. default is true |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Disable JavaScript; By default - true
webKitSettings.EnableJavaScript = false;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Disable JavaScript; By default True
webKitSettings.EnableJavaScript = False
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
EnableOfflineMode
Gets or sets the Enable Offline mode; default value false;
Declaration
public bool EnableOfflineMode { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Enable offline mode
webKitSettings.EnableOfflineMode = true;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable offline mode
webKitSettings.EnableOfflineMode = True
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save the document.
document.Save("Sample.pdf")
document.Close()
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 |
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/";
//Enable html table footer repeat on every page.
webKitSettings.EnableRepeatTableFooter = true;
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
' WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
' Enable html table header repeat on every page.
webKitSettings.EnableRepeatTableHeader = True
'Enable html table footer repeat on every page.
webKitSettings.EnableRepeatTableFooter = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 |
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/";
// Enable html table header repeat on every page.
webKitSettings.EnableRepeatTableHeader = true;
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
' WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
' Enable html table header repeat on every page.
webKitSettings.EnableRepeatTableHeader = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 |
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/";
// Enable table of contents
webKitSettings.EnableToc = true;
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable table of contents
webKitSettings.EnableToc = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the document
document.Save("Output.pdf")
document.Close()
HtmlEncoding
Declaration
public Encoding HtmlEncoding { get; set; }
Property Value
Type |
---|
System.Text.Encoding |
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.
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/";
//Add post parameters
webKitSettings.HttpPostFields.Add("firstName", "Andrew");
webKitSettings.HttpPostFields.Add("lastName", "Fuller");
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("http://asp.syncfusion.com/demos/http_post_get/default.aspx");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Add post parameters
webKitSettings.HttpPostFields.Add("firstName", "Andrew")
webKitSettings.HttpPostFields.Add("lastName", "Fuller")
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://asp.syncfusion.com/demos/http_post_get/default.aspx")
'Save and close the document
document.Save("Output.pdf")
document.Close()
HttpRequestHeaders
Declaration
public HttpRequestHeaderCollection HttpRequestHeaders { get; set; }
Property Value
Type |
---|
HttpRequestHeaderCollection |
Margin
Gets or sets the margins to the PDF 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. |
Examples
//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings.
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set margins
webKitSettings.Margin.All = 20;
//Assign WebKit settings to HTML converter.
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML string to PDF.
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter.
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings.
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set margins
webKitSettings.Margin.All = 20
'Assign WebKit settings to HTML converter.
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML string to PDF.
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
MediaType
Gets or sets media type of WebKit HTML converter
Declaration
public MediaType MediaType { get; set; }
Property Value
Type |
---|
MediaType |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set print media type
webKitSettings.MediaType = MediaType.Print;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set print media type
webKitSettings.MediaType = MediaType.Print
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
Orientation
Gets or sets the Orientation of the 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 |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set PDF page orientation
webKitSettings.Orientation = PdfPageOrientation.Landscape;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set PDF page orientation
webKitSettings.Orientation = PdfPageOrientation.Landscape
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
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
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set PDF page rotation angle
webKitSettings.PageRotateAngle = PdfPageRotateAngle.RotateAngle90;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set PDF page rotation angle
webKitSettings.PageRotateAngle = PdfPageRotateAngle.RotateAngle90
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
Password
Gets or Sets the password;
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the password of the HTML document. By default "" |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
// Set username and password to convert windows authenticated webpage to PDF.
webKitSettings.Username = "username";
webKitSettings.Password = "password";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set username and password to convert windows authenticated webpage to PDF.
webKitSettings.Username = "username"
webKitSettings.Password = "password"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
PdfFooter
Gets or sets the Footer to the PDF document;
Declaration
public PdfPageTemplateElement PdfFooter { get; set; }
Property Value
Type | Description |
---|---|
PdfPageTemplateElement | The PdfPageTemplateElement to draw into the PDF page. By default null |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Create PDF page template element for footer with bounds.
PdfPageTemplateElement footer = new PdfPageTemplateElement(new RectangleF(0, 0, webKitSettings.PdfPageSize.Width, 50));
//Create font and brush for header element.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 7);
PdfBrush brush = new PdfSolidBrush(Color.Black);
//Draw the footer string in footer template element.
footer.Graphics.DrawString("This is footer", font, brush, PointF.Empty);
//Assign the footer element to PdfFooter of WebKit settings.
webKitSettings.PdfFooter = footer;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Create PDF page template element for footer with bounds.
Dim footer As New PdfPageTemplateElement(New RectangleF(0, 0, webKitSettings.PdfPageSize.Width, 50))
'Create font and brush for header element.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 7)
Dim brush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw the footer string in footer template element.
footer.Graphics.DrawString("This is footer", font, brush, PointF.Empty)
'Assign the footer element to PdfFooter of WebKit settings.
webKitSettings.PdfFooter = footer
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
PdfHeader
Gets or sets the Header to the PDF document;
Declaration
public PdfPageTemplateElement PdfHeader { get; set; }
Property Value
Type | Description |
---|---|
PdfPageTemplateElement | The PdfPageTemplateElement to draw into the PDF page. By default null |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Create PDF page template element for header with bounds.
PdfPageTemplateElement header = new PdfPageTemplateElement(new RectangleF(0, 0, webKitSettings.PdfPageSize.Width, 50));
//Create font and brush for header element.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 7);
PdfBrush brush = new PdfSolidBrush(Color.Black);
//Draw the header string in header template element.
header.Graphics.DrawString("This is header", font, brush, PointF.Empty);
//Assign the header element to PdfHeader of WebKit settings.
webKitSettings.PdfHeader = header;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Create PDF page template element for header with bounds.
Dim header As New PdfPageTemplateElement(New RectangleF(0, 0, webKitSettings.PdfPageSize.Width, 50))
'Create font and brush for header element.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 7)
Dim brush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw the header string in header template element.
header.Graphics.DrawString("This is header", font, brush, PointF.Empty)
'Assign the header element to PdfHeader of WebKit settings.
webKitSettings.PdfHeader = header
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
PdfPageSize
Gets or sets the size of the PDF page;
Declaration
public SizeF PdfPageSize { get; set; }
Property Value
Type |
---|
System.Drawing.SizeF |
Remarks
Default value: 595 * 842 pixels(A4 size)
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set PDF page size
webKitSettings.PdfPageSize = new SizeF(595, 842);
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set PDF page size
webKitSettings.PdfPageSize = New SizeF(595, 842)
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
ProxySettings
Gets or sets proxy server settings for WebKit HTML conversion
Declaration
public WebKitProxySettings ProxySettings { get; set; }
Property Value
Type |
---|
WebKitProxySettings |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set manual proxy settings
webKitSettings.ProxySettings.HostName = "127.0.0.1";
webKitSettings.ProxySettings.PortNumber = 8080;
webKitSettings.ProxySettings.Type = WebKitProxyType.Http;
webKitSettings.ProxySettings.Username = "username";
webKitSettings.ProxySettings.Password = "password";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set manual proxy settings
webKitSettings.ProxySettings.HostName = "127.0.0.1"
webKitSettings.ProxySettings.PortNumber = 8080
webKitSettings.ProxySettings.Type = WebKitProxyType.Http
webKitSettings.ProxySettings.Username = "username"
webKitSettings.ProxySettings.Password = "password"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
SinglePageLayout
Use this option to render the whole HTML content into a single PDF page
Declaration
public SinglePageLayout SinglePageLayout { get; set; }
Property Value
Type |
---|
SinglePageLayout |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Set signle page layout.
settings.SinglePageLayout = SinglePageLayout.FitHeight;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Set signle page layout.
settings.SinglePageLayout = SinglePageLayout.FitHeight
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
SplitImages
Gets or sets a value indicating whether [split images].
Declaration
public bool SplitImages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set SplitImages to avoid image split between pages.
webKitSettings.SplitImages = false;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set SplitImages to avoid image split between pages.
webKitSettings.SplitImages = False
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
SplitTextLines
Gets or sets a value indicating whether [split text lines].
Declaration
public bool SplitTextLines { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Set SplitTextLines to avoid text split between pages.
webKitSettings.SplitTextLines = false;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Set SplitTextLines to avoid text split between pages.
webKitSettings.SplitTextLines = False
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
TempFileName
Gets or sets the WebKit temporary process name
Declaration
public string TempFileName { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Set file name for temporary files.
settings.TempFileName = @"syncfusiontempfile";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim settings As WebKitConverterSettings = New WebKitConverterSettings
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Set file name for temporary files.
settings.TempPath = "syncfusiontempfile"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(true)
TempPath
Gets or sets the temp path where the temporary operations are performed if any;
Declaration
public string TempPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Temp path which contains internal conversion files.By default %temp% |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Set Temporary Path to generate temporary files
settings.TempPath = @"C:/HtmlConversion/Temp/";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim settings As WebKitConverterSettings = New WebKitConverterSettings
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Set Temporary Path to generate temporary files
settings.TempPath = "C:/HtmlConversion/Temp/"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(true)
Timeout
Set the maximum time in milliseconds to wait for HTML page to be loaded;
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Specifies the timeout to the HTML converter.Unit is Milliseconds; By default 0 |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set timeout for conversion.
webKitSettings.Timeout = 3000;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set timeout for conversion.
webKitSettings.Timeout = 3000
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
Toc
Gets or sets Toc styles
Declaration
public HtmlToPdfToc Toc { get; set; }
Property Value
Type |
---|
HtmlToPdfToc |
Examples
//Initialize HTML to PDF converter with WebKit Rendering Engine.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize HTML to PDF converter
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Assign the WebKit binaries path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Enable TOC
webKitSettings.EnableToc = true;
//Set the style for level 1(H1) items in table of contents
HtmlToPdfTocStyle tocstyleH1 = new HtmlToPdfTocStyle();
tocstyleH1.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 10, PdfFontStyle.Regular);
tocstyleH1.BackgroundColor = new PdfSolidBrush(new PdfColor(Color.FromArgb(68, 114, 196)));
tocstyleH1.ForeColor = PdfBrushes.White;
tocstyleH1.Padding = new PdfPaddings(5, 5, 3, 3);
webKitSettings.Toc.SetItemStyle(1, tocstyleH1);
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with WebKit Rendering Engine.
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize HTML to PDF converter
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable TOC
webKitSettings.EnableToc = True
'Set the style for level 1(H1) items in table of contents
Dim tocstyleH1 As New HtmlToPdfTocStyle()
tocstyleH1.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 10, PdfFontStyle.Regular)
tocstyleH1.BackgroundColor = New PdfSolidBrush(New PdfColor(Color.FromArgb(68, 114, 196)))
tocstyleH1.ForeColor = PdfBrushes.White
tocstyleH1.Padding = New PdfPaddings(5, 5, 3, 3)
webKitSettings.Toc.SetItemStyle(1, tocstyleH1)
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
See Also
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
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Enable table of contents
webKitSettings.EnableToc = True
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Get Toc Page Count
Dim tocPageCount As int = settings.TocPageCount
'Save and close the document
document.Save("Output.pdf")
document.Close()
Username
Gets or Sets the Username;
Declaration
public string Username { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the password of the HTML document. By default "" |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
// Set username and password to convert windows authenticated webpage to PDF.
webKitSettings.Username = "username";
webKitSettings.Password = "password";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set username and password to convert windows authenticated webpage to PDF.
webKitSettings.Username = "username"
webKitSettings.Password = "password"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
WebKitPath
Gets or Sets WebKit assembly path;
Declaration
public string WebKitPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies WebKit assemblies path.By default bin folder |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the WebKit converter settings
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKitPath
webKitSettings.WebKitPath = "/QtBinaries/"
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
WebKitViewPort
WebKit view port size;
Declaration
public Size WebKitViewPort { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Size | By default use system ViewPort size |
Examples
//Initialize HTML converter with WebKit rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
//Set WebKit path
webKitSettings.WebKitPath = @"/QtBinaries/";
//Set WebKit viewport size
webKitSettings.WebKitViewPort = new Size(800,0);
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with WebKit rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim webKitSettings As New WebKitConverterSettings()
'Set WebKit path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set WebKit viewport size
webKitSettings.WebKitViewPort = New Size(800, 0)
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = webKitSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
See Also
WindowStatus
Gets or Sets the window status
Declaration
public string WindowStatus { get; set; }
Property Value
Type |
---|
System.String |
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/";
// Set windows status.
webKitSettings.WindowStatus = "completed";
//Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings;
//Convert HTML to PDF
PdfDocument document = htmlConverter.Convert("input.html");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'WebKit converter settings
Dim webKitSettings As New WebKitConverterSettings()
'Assign the WebKit binaries path
webKitSettings.WebKitPath = "/QtBinaries/"
'Set windows status.
webKitSettings.WindowStatus = "completed"
'Assign the WebKit settings
htmlConverter.ConverterSettings = webKitSettings
'Convert HTML to PDF
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close()