Class BlinkConverterSettings
Class that represents the settings of the Blink rendering engine.
Inheritance
Implements
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public class BlinkConverterSettings : Object, IHtmlConverterSettings
Examples
//Initialize HtmlToPdfConverter with BlinkConverterSettings HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set Blink settings blinkSettings.BlinkPath = "BlinkBinaries"; blinkSettings.AdditionalDelay = 1000; blinkSettings.Cookies.Add("CookieName", "CookieValue"); blinkSettings.EnableBookmarks = true; blinkSettings.EnableForm = true; blinkSettings.EnableHyperLink = true; blinkSettings.EnableJavaScript = true; blinkSettings.EnableOfflineMode = false; blinkSettings.EnableRepeatTableHeader = true; blinkSettings.EnableRepeatTableFooter = true; blinkSettings.EnableToc = true; blinkSettings.HttpPostFields.Add("PostKey", "PostValue"); blinkSettings.HttpRequestHeaders.Add("HeaderKey", "HeaderValue"); blinkSettings.Margin.All = 10; blinkSettings.MediaType = MediaType.Print; blinkSettings.Orientation = PdfPageOrientation.Landscape; blinkSettings.PageRotateAngle = PdfPageRotateAngle.RotateAngle0; blinkSettings.Username = ""; blinkSettings.Password = ""; blinkSettings.PdfPageSize = new SizeF(200, 300); blinkSettings.SinglePageLayout = SinglePageLayout.None; blinkSettings.ViewPortSize = new Size(1024, 0); blinkSettings.WindowStatus = ""; //Set Blink settings to the converter htmlConverter.ConverterSettings = blinkSettings; //Convert partial HTML to PDF using HTML element ID PdfDocument document = htmlConverter.Convert("http://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Constructors
BlinkConverterSettings()
Initializes a new instance of the BlinkConverterSettings class.
Declaration
public BlinkConverterSettings()
Examples
//Initialize HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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
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 2000 |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; // Set additional delay; units in milliseconds blinkConverterSettings.AdditionalDelay = 3000; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com") //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
BlinkPath
Gets or sets the Blink binaries path.
Declaration
public string BlinkPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies Blink assemblies path. By default bin folder |
Examples
//Initialize HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
CommandLineArguments
Gets or sets the Blink command line arguments.
Declaration
public BlinkCommandLineArguments CommandLineArguments { get; set; }
Property Value
Type |
---|
BlinkCommandLineArguments |
Examples
Initialize HTML converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blink converter settings BlinkConverterSettings BlinkSettings = new BlinkConverterSettings(); //Assign the Blink path BlinkSettings.BlinkPath = @"/BlinkBinaries/"; //Add Blink command line arguments BlinkSettings.CommandLineArguments.Add("--no-proxy-server"); htmlConverter.ConverterSettings = BlinkSettings; //Convert url to pdf PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
ConversionTimeout
Get or Set the conversion timeout value in milliseconds.
Declaration
public int ConversionTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | By default time out limit as 30000 ms. |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); ////Set the conversion timeout value in milliseconds. blinkConverterSettings.ConversionTimeout = 30000; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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
Cookies
Gets or sets the cookie collection with their name and value.
Declaration
public CookieCollection Cookies { get; set; }
Property Value
Type | Description |
---|---|
CookieCollection | The cookies Collection |
Examples
// Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; // Add cookies as name and value pair blinkConverterSettings.Cookies.Add("CookieName1", " CookieValue1"); blinkConverterSettings.Cookies.Add("CookieName2", " CookieValue2"); //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.example.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
See Also
CropRegion
Gets or sets the rectangular region used to crop the HTML content when converting to PDF or image.
Declaration
public RectangleF CropRegion { set; }
Property Value
Type |
---|
System.Drawing.RectangleF |
Examples
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize the BlinkConverterSettings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set the clip size to crop the image. settings.CropRegion = new RectangleF(0, 10, 250, 500); //Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter. htmlConverter.ConverterSettings = settings; //Convert HTML to Image Image image = converter.ConvertToImage("Input.html"); //Save the Image. byte[] imageByte = image.ImageData; File.WriteAllBytes("Output.png", imageByte);
Css
Gets or sets the CSS to be applied in HTML or URL before rendering to PDF.
Declaration
public string Css { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set Blink viewport size. blinkConverterSettings.ViewPortSize = new Size(1280, 0); blinkConverterSettings.Margin.All = 30; //Set the Html Style blinkConverterSettings.Css = ""; htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); //Create a filestream. FileStream fileStream = new FileStream("Test.pdf", FileMode.CreateNew, FileAccess.ReadWrite); //Save and close the PDF document. document.Save(fileStream); document.Close(true);
EnableAccessibilityTags
Declaration
public bool EnableAccessibilityTags { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableAutoScaling
Set EnableAutoScaling to true to automatically scale the HTML content to fit the PDF dimensions during the conversion process.
Declaration
public bool EnableAutoScaling { set; }
Property Value
Type |
---|
System.Boolean |
Examples
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Initialize the BlinkConverterSettings
BlinkConverterSettings settings = new BlinkConverterSettings();
//Set the Fit Scale value
Settings.EnableAutoScaling = true;
//Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter.
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("Input.html");
//Save and close the PDF document.
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
document.Save(fileStream);
document.Close(true);
EnableBookmarks
A property indicating if the automatic creation of bookmarks in a 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 to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set enable bookmarks settings.EnableBookmarks = true; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Save and close the PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableForm
Gets or sets enable form; If it is enabled, then HTML form fields are converted to PDF form fields in the generated PDF document. By default, false.
Declaration
public bool EnableForm { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set enable form settings.EnableForm = true; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.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.
Declaration
public bool EnableHyperLink { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If true, the Hyperlinks will be enabled, otherwise disabled. By default true |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Enable hyperlinks; By default - true blinkConverterSettings.EnableHyperLink = false; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://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.
Declaration
public bool EnableJavaScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If true, the Javascript will be enabled, otherwise disabled. By default true |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Disable JavaScript; By default, true blinkConverterSettings.EnableJavaScript = false; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableLazyLoadImages
Gets or sets the lazy load images; default value false;
Declaration
public bool EnableLazyLoadImages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If true, the LazyLoadImages will be enabled, otherwise disabled. By default false |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Enable LazyLoadImages; By default, false blinkConverterSettings.EnableLazyLoadImages = true; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableLocalFileAccess
Gets or sets a value that indicates whether the local files access is enable or not. The default values is true.
Declaration
public bool EnableLocalFileAccess { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If false, the converter will not load the resources from local file path. By default true |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Disable LocalFileAccess; By default, true blinkConverterSettings.EnableLocalFileAccess = false; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableOfflineMode
Gets or sets the offline mode. By default, false.
Declaration
public bool EnableOfflineMode { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Enable offline mode blinkConverterSettings.EnableOfflineMode = true; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com") //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
EnableToc
A property indicating if the automatic creation of the 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 to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set enable toc settings.EnableToc = true; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
HtmlEncoding
Gets or sets Encoding for HTML string to PDF conversion.
Declaration
public Encoding HtmlEncoding { get; set; }
Property Value
Type |
---|
System.Text.Encoding |
Remarks
This property will not have any effect on URL to PDF conversion
Examples
//HTML string and Base URL string htmlText = "
Hello World
"; //Path of the resources (Images, styles, scripts) used in the htmlText. string baseUrl = "C:/Temp/HTMLFiles/"; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize the Blink converter settings. BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = @"/BlinkBinaries/"; //Set encoding for HTML string to PDF conversion. blinkSettings.HtmlEncoding = Encoding.UTF8; //Assign Blink settings to HTML converter. htmlConverter.ConverterSettings = blinkSettings; //Convert HTML string to PDF. PdfDocument document = htmlConverter.Convert(htmlText, baseUrl); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);HtmlFooter
Declaration
public string HtmlFooter { get; set; }
Property Value
Type |
---|
System.String |
HtmlHeader
Declaration
public string HtmlHeader { get; set; }
Property Value
Type |
---|
System.String |
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.Blink); // Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Assign the Blink binaries path blinkSettings.BlinkPath = @"/BlinkBinaries/"; //Add post parameters blinkSettings.HttpPostFields.Add("firstName", "Andrew"); blinkSettings.HttpPostFields.Add("lastName", "Fuller"); //Assign the Blink settings htmlConverter.ConverterSettings = blinkSettings; //Convert HTML to PDF PdfDocument document = htmlConverter.Convert("http://asp.syncfusion.com/demos/http_post_get/default.aspx"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
HttpRequestHeaders
Gets or sets the HTTP Request headers.
Declaration
public HttpRequestHeaderCollection HttpRequestHeaders { get; set; }
Property Value
Type |
---|
HttpRequestHeaderCollection |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = @"/BlinkBinaries/"; //Add a bearer token to login a webpage settings.HttpRequestHeaders.Add("Authorization", "bearer tokenValue"); //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.example.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
ImageBackgroundColor
Gets or sets the JavaScript to be executed during the HTML to PDF conversion.
Declaration
public Color ImageBackgroundColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Examples
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the Image Background color. settings.ImageBackgroundColor = Color.Transparent; //Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter. htmlConverter.ConverterSettings = settings; //Convert HTML to Image Image image = converter.ConvertToImage("Input.html"); //Save the Image. byte[] imageByte = image.ImageData; File.WriteAllBytes("Output.png", imageByte);
JavaScript
Gets or sets the JavaScript to be executed during the HTML to PDF conversion.
Declaration
public string JavaScript { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set Blink viewport size. blinkConverterSettings.ViewPortSize = new Size(1280, 0); blinkConverterSettings.Margin.All = 30; //Set the JavaScript blinkConverterSettings.JavaScript = "; htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); //Create a filestream. FileStream fileStream = new FileStream("Test.pdf", FileMode.CreateNew, FileAccess.ReadWrite); //Save and close the PDF document. document.Save(fileStream); document.Close(true);
Margin
Gets or sets the margins to a 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.Blink); //Initialize the Blink converter settings. BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = @"/BlinkBinaries/"; //Set margins blinkSettings.Margin.All = 20; //Assign Blink settings to HTML converter. htmlConverter.ConverterSettings = blinkSettings; //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
MediaType
Gets or sets the media type of Blink HTML converter.
Declaration
public MediaType MediaType { get; set; }
Property Value
Type |
---|
MediaType |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Set print media type blinkConverterSettings.MediaType = MediaType.Print; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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
Orientation
Gets or sets the orientation of a PDF document.
Declaration
public PdfPageOrientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
PdfPageOrientation | The PdfPageOrientation, provides the orientation of the PDF page. By default Portrait |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize the Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = "/BlinkBinaries/"; //Set PDF page orientation blinkSettings.Orientation = PdfPageOrientation.Landscape; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = blinkSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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.Blink); //Initialize the Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = "/BlinkBinaries/"; //Set PDF page rotation angle blinkSettings.PageRotateAngle = PdfPageRotateAngle.RotateAngle90; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = blinkSettings; //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.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the password of web page. By default empty |
Examples
// Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; blinkConverterSettings.Username = "username"; blinkConverterSettings.Password = "password"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.example.com") //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
PdfFooter
Gets or sets the Footer to a PDF document.
Declaration
public PdfPageTemplateElement PdfFooter { get; set; }
Property Value
Type | Description |
---|---|
PdfPageTemplateElement | The PdfPageTemplateElement to draw into the PDF page. By default null |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize the Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = "/BlinkBinaries/"; //Create PDF page template element for footer with bounds. PdfPageTemplateElement footer = new PdfPageTemplateElement(new RectangleF(0, 0, blinkSettings.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 Blink settings. blinkSettings.PdfFooter = footer; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = blinkSettings; //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.
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.Blink); //Initialize the Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = "/BlinkBinaries/"; //Create PDF page template element for header with bounds. PdfPageTemplateElement header = new PdfPageTemplateElement(new RectangleF(0, 0, blinkSettings.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 Blink settings. blinkSettings.PdfHeader = header; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = blinkSettings; //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.
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.Blink); //Initialize the Blink converter settings BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Set BlinkPath blinkSettings.BlinkPath = "/BlinkBinaries/"; //Set PDF page size blinkSettings.PdfPageSize = new SizeF(595, 842); //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = blinkSettings; //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
ProxySettings
Gets or sets the proxy server settings for Blink rendering engine.
Declaration
public BlinkProxySettings ProxySettings { get; set; }
Property Value
Type |
---|
BlinkProxySettings |
Examples
//Initialize HTML converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings BlinkSettings = new BlinkConverterSettings(); //Set Blink path BlinkSettings.BlinkPath = @"/BlinkBinaries/"; //Set manual proxy settings BlinkSettings.ProxySettings.HostName = "127.0.0.1"; BlinkSettings.ProxySettings.PortNumber = 8080; BlinkSettings.ProxySettings.Type = BlinkProxyType.Http; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = BlinkSettings; //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
Scale
Gets or sets the scaling factor for HTML to PDF conversion.
Declaration
public float Scale { get; set; }
Property Value
Type |
---|
System.Single |
Remarks
Scaling factor range should from 0.1 to 2.0, otherwise the conversion gets failed
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set scaling factor settings.Scale = 1.0F; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
SinglePageLayout
Use this option to render a whole HTML content into single PDF page.
Declaration
public SinglePageLayout SinglePageLayout { get; set; }
Property Value
Type |
---|
SinglePageLayout |
Examples
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set single page layout settings.SinglePageLayout = SinglePageLayout.FitWidth; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
TempFileName
Gets or sets the temporary TempFileName for the conversion.
Declaration
public string TempFileName { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Set name to the Temporary files blinkConverterSettings.TempFileName = @"syncfusiontempfile"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF htmlConverter.Convert("https://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.
Declaration
public string TempPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Temp path which contains internal conversion files. By default %temp% |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Set Temporary Path to generate temporary files blinkConverterSettings.TempPath = @"C:/HtmlConversion/Temp/"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF htmlConverter.Convert("https://www.google.com"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Toc
Gets or sets Toc styles
Declaration
public HtmlToPdfToc Toc { get; set; }
Property Value
Type |
---|
HtmlToPdfToc |
Examples
//Initialize HTML to PDF converter with Blink Rendering Engine. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); //Initialize HTML to PDF converter BlinkConverterSettings blinkSettings = new BlinkConverterSettings(); //Assign the Blink binaries path blinkSettings.BlinkPath = @"/BlinkBinaries/"; //Enable TOC blinkSettings.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); blinkSettings.Toc.SetItemStyle(1, tocstyleH1); //Assign the Blink settings htmlConverter.ConverterSettings = blinkSettings; //Convert HTML to PDF PdfDocument document = htmlConverter.Convert("input.html"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
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.Blink); //Initialize Blinkconverter settings BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/BlinkBinaries/"; //Set enable toc settings.EnableToc = true; //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com/"); //Get Toc Page Count int tocPageCount = settings.TocPageCount; //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Username
Gets or sets the username.
Declaration
public string Username { get; set; }
Property Value
Type | Description |
---|---|
System.String | String value representing the user name of web page. By default empty |
Examples
// Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; blinkConverterSettings.Username = "username"; blinkConverterSettings.Password = "password"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("https://www.example.com") //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
ViewPortSize
Gets or sets the Blink view port size.
Declaration
public Size ViewPortSize { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Size | By default 1024x0 ViewPort size |
Examples
//Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; //Set Blink viewport size blinkConverterSettings.ViewPortSize = new Size(800, 0); //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //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
WaitForExternalFonts
Gets or sets a Boolean value indicating whether the HTML to PDF conversion should wait until external fonts are loaded in a browser. The default value is False.
Declaration
public bool WaitForExternalFonts { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize the BlinkConverterSettings BlinkConverterSettings settings = new BlinkConverterSettings(); //set wait for font rendering Settings.WaitForExternalFonts = true; //Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter. htmlConverter.ConverterSettings = settings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("Input.html"); //Save and close the PDF document. FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); document.Save(fileStream); document.Close(true);
WindowStatus
Gets or sets the window status.
Declaration
public string WindowStatus { get; set; }
Property Value
Type |
---|
System.String |
Examples
// Initialize the HTML to PDF converter with Blink rendering engine HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); //Set the BlinkBinaries folder path blinkConverterSettings.BlinkPath = @"/BlinkBinaries/"; // Set windows status. blinkConverterSettings.WindowStatus = "completed"; //Assign Blink converter settings to HTML converter htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF PdfDocument document = htmlConverter.Convert("input.html"); //Save the output PDF document MemoryStream stream = new MemoryStream(); document.Save(stream);
Explicit Interface Implementations
IHtmlConverterSettings.SplitImages
Declaration
bool IHtmlConverterSettings.SplitImages { get; set; }
Returns
Type |
---|
System.Boolean |
IHtmlConverterSettings.SplitTextLines
Declaration
bool IHtmlConverterSettings.SplitTextLines { get; set; }
Returns
Type |
---|
System.Boolean |
IHtmlConverterSettings.WebKitPath
Declaration
string IHtmlConverterSettings.WebKitPath { get; set; }
Returns
Type |
---|
System.String |
IHtmlConverterSettings.WebKitViewPort
Declaration
Size IHtmlConverterSettings.WebKitViewPort { get; set; }
Returns
Type |
---|
System.Drawing.Size |