BlinkConverterSettings Class
Class which represents the settings of Blink rendering engine
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.HtmlConverter
Assembly: Syncfusion.HtmlConverter.Base.dll
Syntax
public class BlinkConverterSettings : IHtmlConverterSettings
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
See Also
Properties
AdditionalDelay
Gets or sets the additional delay to load JavaScript;
Declaration
public int AdditionalDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Specifies the delay to load the 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
AspectRatio
Gets or sets the aspect ratio.
Declaration
[Obsolete("This property does not have any effect with the Blink rendering engine.")]
public AspectRatio AspectRatio { get; set; }
Property Value
Type |
---|
AspectRatio |
Remarks
This property does not have any effect with Blink rendering engine.
BlinkPath
Gets or Sets Blink folder path;
Declaration
public string BlinkPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies Blink binaries 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blink converter settings
Dim BlinkSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
ConversionTimeout
Gets or sets the timeout for HTML to PDF conversion in milliseconds.
Declaration
public int ConversionTimeout { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
//Initialize HTML to PDF converter with Blink rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
//sets the timeout for HTML to PDF conversion 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'sets the timeout for HTML to PDF conversion in milliseconds.
blinkConverterSettings.ConversionTimeout = 30000
'Assign Blink converter settings to HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings
'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 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'Set the BlinkBinaries folder path
blinkConverterSettings.BlinkPath = "/BlinkBinaries/"
'Add cookies
blinkConverterSettings.Cookies.Add("Name1", "Value1")
blinkConverterSettings.Cookies.Add("Name2", "Value2")
'Assign Blink converter settings to HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.example.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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
Gets or sets a value indicating whether to preserve accessibility tags during HTML to PDF conversion. When set to true, ensures that accessibility tags are retained for enhanced document accessibility.
Declaration
public bool EnableAccessibilityTags { 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 true to enable tagged PDF generation.
settings.EnableAccessibilityTags = 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
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As New BlinkConverterSettings()
'Set Blink path
settings.BlinkPath = "/BlinkBinaries/"
'Set true to enable tagged PDF generation.
settings.EnableAccessibilityTags = true
'Assign Blink settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
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 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
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
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 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 and close the PDF document
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
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 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = NewHtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 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);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
EnableLazyLoadImages
Gets or sets the lazy load images; default value false;
Declaration
public bool EnableLazyLoadImages { 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 lazy image loading mode
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);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'Set the BlinkBinaries folder path
blinkConverterSettings.BlinkPath = "/BlinkBinaries/"
'Enable lazy image loading mode
blinkConverterSettings.EnableLazyLoadImages = True
'Assign Blink converter settings to HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings
'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)
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);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'Set the BlinkBinaries folder path
blinkConverterSettings.BlinkPath = "/BlinkBinaries/"
'Disable local file access
blinkConverterSettings.EnableLocalFileAccess = False
'Assign Blink converter settings to HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings
'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)
EnableOfflineMode
Gets or sets the Enable Offline mode; default value 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'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 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 and close the PDF document
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
HtmlEncoding
Declaration
public Encoding HtmlEncoding { get; set; }
Property Value
Type |
---|
System.Text.Encoding |
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Blink converter settings
Dim blinkSettings As 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
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 |
ImageBackgroundColor
Gets or sets the background color for the image during HTML to image conversion. This property is applicable only when converting HTML to an image, allowing customization of the background color.
Declaration
public Color ImageBackgroundColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
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 of the page.
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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter.
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings.
Dim blinkSettings As 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.
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 Blink rendering engine
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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.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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings
Dim blinkSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings
Dim blinkSettings As 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
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 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.example.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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.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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings
Dim blinkSettings As New BlinkConverterSettings()
'Set BlinkPath
blinkSettings.BlinkPath = "/BlinkBinaries/"
'Create PDF page template element for footer with bounds.
Dim footer As New PdfPageTemplateElement(New RectangleF(0, 0, blinkSettings.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 Blink settings.
blinkSettings.PdfFooter = footer
'Assign Blink settings to HTML converter
htmlConverter.ConverterSettings = blinkSettings
'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.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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings
Dim blinkSettings As New BlinkConverterSettings()
'Set BlinkPath
blinkSettings.BlinkPath = "/BlinkBinaries/"
'Create PDF page template element for header with bounds.
Dim header As New PdfPageTemplateElement(New RectangleF(0, 0, blinkSettings.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 Blink settings.
blinkSettings.PdfHeader = header
'Assign Blink settings to HTML converter
htmlConverter.ConverterSettings = blinkSettings
'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.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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize the Blink converter settings
Dim blinkSettings As 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
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 Blink HTML conversion
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 document.
document.Save("Sample.pdf");
document.Close();
'Initialize HTML converter with Blink rendering engine
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim BlinkSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save the document.
document.Save("Sample.pdf")
document.Close()
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 and close the PDF document
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
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.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 and close the PDF document
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
SplitImages
Gets or sets a value indicating whether the images can be split across the PDF pages.
Declaration
[Obsolete("This property does not have any effect with the Blink rendering engine.")]
public bool SplitImages { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This property does not have any effect with Blink rendering engine.
SplitTextLines
Gets or sets a value indicating whether the text can be split across the PDF pages.
Declaration
[Obsolete("This property does not have any effect with the Blink rendering engine.")]
public bool SplitTextLines { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This property does not have any effect with Blink rendering engine.
TempFileName
Gets or sets the 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
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 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink Rendering Engine.
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize HTML to PDF converter
Dim blinkSettings As 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
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)
blinkSettings.Toc.SetItemStyle(1, tocstyleH1)
'Assign the Blink settings
htmlConverter.ConverterSettings = blinkSettings
'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.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
document.Save("Sample.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
'Initialize Blinkconverter settings
Dim settings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com/")
'Get Toc Page Count
Dim tocPageCount As int = settings.TocPageCount
'Save and close the PDF document
document.Save("Sample.pdf")
document.Close(True)
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 the HTML document. By default "" |
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.example.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
ViewPortSize
Blink view port size; HTML Content will be scaled based on the given viewport 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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
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 and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As 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
Dim document As PdfDocument = htmlConverter.Convert("input.html")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)