Interface IHtmlConverterSettings
Interface for Rendering engine settings
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public interface IHtmlConverterSettings
Examples
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://www.google.com");
//Save the document.
document.Save("Sample.pdf");
document.Close();
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Initialize the converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
Properties
AdditionalDelay
Gets or sets the additional delay to load JavaScript; Unit is Milliseconds; By default 0
Declaration
int AdditionalDelay { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set AdditionalDelay for conversion
converterSettings.AdditionalDelay = 2000;
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set AdditionalDelay for conversion
converterSettings.AdditionalDelay = 2000
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
AspectRatio
Gets or sets the aspect ratio; By default None
Declaration
AspectRatio AspectRatio { get; set; }
Property Value
Type |
---|
AspectRatio |
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()
EnableHyperLink
Gets or Sets a value indicating whether to preserve the live-links in the converted document or not;By default true
Declaration
bool EnableHyperLink { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set EnableHyperLink
converterSettings.EnableHyperLink = true;
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set EnableHyperLink
converterSettings.EnableHyperLink = True
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://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; By default true
Declaration
bool EnableJavaScript { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set EnableJavaScript
converterSettings.EnableJavaScript = true;
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set EnableJavaScript
converterSettings.EnableJavaScript = True
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
Margin
Gets or sets the margins to the PDF document; By default all margins are 0
Declaration
PdfMargins Margin { get; set; }
Property Value
Type |
---|
PdfMargins |
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
Orientation
Gets or sets the Orientation of the PDF document; By default Portrait
Declaration
PdfPageOrientation Orientation { get; set; }
Property Value
Type |
---|
PdfPageOrientation |
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
PdfPageRotateAngle PageRotateAngle { get; set; }
Property Value
Type |
---|
PdfPageRotateAngle |
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; By default ""
Declaration
string Password { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set username and password for windows authentication
converterSettings.Username = "username";
converterSettings.Password = "password";
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set username and password for windows authentication
converterSettings.Username = "username"
converterSettings.Password = "password"
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
PdfFooter
Gets or sets the Footer to the PDF document; By default null
Declaration
PdfPageTemplateElement PdfFooter { get; set; }
Property Value
Type |
---|
PdfPageTemplateElement |
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; By default null
Declaration
PdfPageTemplateElement PdfHeader { get; set; }
Property Value
Type |
---|
PdfPageTemplateElement |
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; By default A4 size
Declaration
SizeF PdfPageSize { get; set; }
Property Value
Type |
---|
System.Drawing.SizeF |
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
SplitImages
Gets or sets a value indicating whether [split images].
Declaration
bool SplitImages { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set split images to false to avoid image split between PDF pages.
converterSettings.SplitImages = false;
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set split images to false to avoid image split between PDF pages.
converterSettings.SplitImages = False
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
SplitTextLines
Gets or sets a value indicating whether [split text lines].
Declaration
bool SplitTextLines { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set split text lines to false to avoid text split between PDF pages.
converterSettings.SplitTextLines = false;
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set split text lines to false to avoid text split between PDF pages.
converterSettings.SplitTextLines = False
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
TempPath
Gets or sets the temp path where the temporary operations are performed if any;By default %temp%
Declaration
string TempPath { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set temporary path for conversion
converterSettings.TempPath = @"C:/HtmlConversion/Temp/";
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set temporary path for conversion
converterSettings.TempPath = "C:/HtmlConversion/Temp/"
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
Username
Gets or Sets the Username; By default ""
Declaration
string Username { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Initialize the converter settings
IHtmlConverterSettings converterSettings = new WebKitConverterSettings();
//Set WebKitPath
(converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/";
//Set username and password for windows authentication
converterSettings.Username = "username";
converterSettings.Password = "password";
//Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://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 converter settings
Dim converterSettings As IHtmlConverterSettings = New WebKitConverterSettings()
'Set WebKitPath
TryCast(converterSettings, WebKitConverterSettings).WebKitPath = "/QtBinaries/"
'Set username and password for windows authentication
converterSettings.Username = "username"
converterSettings.Password = "password"
'Assign converter settings to HTML converter
htmlConverter.ConverterSettings = converterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()