Interface IHtmlConverterSettings
Interface for converter settings
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public interface IHtmlConverterSettings
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableJavaScript
Gets or sets a value indicating whether to enable or 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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
HtmlEncoding
Gets or sets HtmlEncoding for HTML string to PDF conversion.
Declaration
Encoding HtmlEncoding { get; set; }
Property Value
Type |
---|
System.Text.Encoding |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize the converter settings IHtmlConverterSettings converterSettings = new WebKitConverterSettings(); //Set WebKitPath (converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/"; //Set Html Encoding converterSettings.HtmlEncoding = Encoding.Default; //Assign converter settings to HTML converter htmlConverter.ConverterSettings = converterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("http://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Margin
Gets or sets the margins to a 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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
Password
Gets or sets the password; By default, empty.
Declaration
string Password { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
PdfFooter
Gets or sets the Footer to a PDF document; By default, null.
Declaration
PdfPageTemplateElement PdfFooter { get; set; }
Property Value
Type |
---|
PdfPageTemplateElement |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
PdfHeader
Gets or sets the Header to a PDF document; By default, null.
Declaration
PdfPageTemplateElement PdfHeader { get; set; }
Property Value
Type |
---|
PdfPageTemplateElement |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
PdfPageSize
Gets or sets the size of a 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(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
SplitImages
Gets or sets the SplitImages property for splitting the images.
Declaration
bool SplitImages { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
SplitTextLines
Gets or sets the SplitTextLines property for splitting the lines.
Declaration
bool SplitTextLines { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
TempPath
Gets or sets the temporary folder path where the temporary operations are performed if any; By default, system temporary folder path.
Declaration
string TempPath { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Username
Gets or sets the username; By default, empty.
Declaration
string Username { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
WebKitPath
Gets or sets a WebKitPath to the converter settings.
Declaration
string WebKitPath { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //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 output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
WebKitViewPort
Gets or sets a WebKitViewPort size.
Declaration
Size WebKitViewPort { get; set; }
Property Value
Type |
---|
System.Drawing.Size |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize the converter settings IHtmlConverterSettings converterSettings = new WebKitConverterSettings(); //Set WebKitPath (converterSettings as WebKitConverterSettings).WebKitPath = @"/QtBinaries/"; //Assign converter settings to HTML converter //Set WebKitPath (converterSettings as WebKitConverterSettings).WebKitViewPort = new Size(800, 0); htmlConverter.ConverterSettings = converterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("http://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);