HtmlToPdfTocStyle Class
This class contains the necessary properties to apply style in the automatic creation of a table of contents in a PDF document.
Inheritance
System.Object
HtmlToPdfTocStyle
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.HtmlToPdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class HtmlToPdfTocStyle
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Enable toc.
settings.EnableToc = true;
//Create a new instance for HTML to PDF toc.
HtmlToPdfToc toc = new HtmlToPdfToc();
//Set title.
toc.Title = "HTML to PDF";
//Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center;
//Create new HTML to PDF Toc Style.
HtmlToPdfTocStyle style = new HtmlToPdfTocStyle();
//Set background color.
style.BackgroundColor = new PdfSolidBrush(Color.LightCyan);
//Set font.
style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set fore color.
style.ForeColor = new PdfSolidBrush(Color.Red);
//Set paddings.
style.Padding = new PdfPaddings(5, 5, 5, 5);
//Set toc style.
toc.TitleStyle = style;
//Set toc to webkit settings.
settings.Toc = toc;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Enable toc.
settings.EnableToc = True
'Create a new instance for HTML to PDF toc.
Dim toc As New HtmlToPdfToc()
'Set title.
toc.Title = "HTML to PDF"
'Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center
'Create new HTML to PDF Toc Style.
Dim style As New HtmlToPdfTocStyle()
'Set background color.
style.BackgroundColor = New PdfSolidBrush(Color.LightCyan)
'Set font.
style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set fore color.
style.ForeColor = New PdfSolidBrush(Color.Red)
'Set paddings.
style.Padding = New PdfPaddings(5, 5, 5, 5)
'Set toc style.
toc.TitleStyle = style
'Set toc to webkit settings.
settings.Toc = toc
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
Constructors
HtmlToPdfTocStyle()
Declaration
public HtmlToPdfTocStyle()
Properties
BackgroundColor
Gets or sets the back ground color
Declaration
public PdfBrush BackgroundColor { get; set; }
Property Value
Type |
---|
PdfBrush |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Enable toc.
settings.EnableToc = true;
//Create a new instance for HTML to PDF toc.
HtmlToPdfToc toc = new HtmlToPdfToc();
//Set title.
toc.Title = "HTML to PDF";
//Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center;
//Create new HTML to PDF Toc Style.
HtmlToPdfTocStyle style = new HtmlToPdfTocStyle();
//Set background color.
style.BackgroundColor = new PdfSolidBrush(Color.LightCyan);
//Set font.
style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set fore color.
style.ForeColor = new PdfSolidBrush(Color.Red);
//Set paddings.
style.Padding = new PdfPaddings(5, 5, 5, 5);
//Set toc style.
toc.TitleStyle = style;
//Set toc to webkit settings.
settings.Toc = toc;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Enable toc.
settings.EnableToc = True
'Create a new instance for HTML to PDF toc.
Dim toc As New HtmlToPdfToc()
'Set title.
toc.Title = "HTML to PDF"
'Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center
'Create new HTML to PDF Toc Style.
Dim style As New HtmlToPdfTocStyle()
'Set background color.
style.BackgroundColor = New PdfSolidBrush(Color.LightCyan)
'Set font.
style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set fore color.
style.ForeColor = New PdfSolidBrush(Color.Red)
'Set paddings.
style.Padding = New PdfPaddings(5, 5, 5, 5)
'Set toc style.
toc.TitleStyle = style
'Set toc to webkit settings.
settings.Toc = toc
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
Font
Gets or sets the font
Declaration
public PdfFont Font { get; set; }
Property Value
Type |
---|
PdfFont |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Enable toc.
settings.EnableToc = true;
//Create a new instance for HTML to PDF toc.
HtmlToPdfToc toc = new HtmlToPdfToc();
//Set title.
toc.Title = "HTML to PDF";
//Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center;
//Create new HTML to PDF Toc Style.
HtmlToPdfTocStyle style = new HtmlToPdfTocStyle();
//Set background color.
style.BackgroundColor = new PdfSolidBrush(Color.LightCyan);
//Set font.
style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set fore color.
style.ForeColor = new PdfSolidBrush(Color.Red);
//Set paddings.
style.Padding = new PdfPaddings(5, 5, 5, 5);
//Set toc style.
toc.TitleStyle = style;
//Set toc to webkit settings.
settings.Toc = toc;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Enable toc.
settings.EnableToc = True
'Create a new instance for HTML to PDF toc.
Dim toc As New HtmlToPdfToc()
'Set title.
toc.Title = "HTML to PDF"
'Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center
'Create new HTML to PDF Toc Style.
Dim style As New HtmlToPdfTocStyle()
'Set background color.
style.BackgroundColor = New PdfSolidBrush(Color.LightCyan)
'Set font.
style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set fore color.
style.ForeColor = New PdfSolidBrush(Color.Red)
'Set paddings.
style.Padding = New PdfPaddings(5, 5, 5, 5)
'Set toc style.
toc.TitleStyle = style
'Set toc to webkit settings.
settings.Toc = toc
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
ForeColor
Gets or sets the fore color
Declaration
public PdfBrush ForeColor { get; set; }
Property Value
Type |
---|
PdfBrush |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Enable toc.
settings.EnableToc = true;
//Create a new instance for HTML to PDF toc.
HtmlToPdfToc toc = new HtmlToPdfToc();
//Set title.
toc.Title = "HTML to PDF";
//Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center;
//Create new HTML to PDF Toc Style.
HtmlToPdfTocStyle style = new HtmlToPdfTocStyle();
//Set background color.
style.BackgroundColor = new PdfSolidBrush(Color.LightCyan);
//Set font.
style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set fore color.
style.ForeColor = new PdfSolidBrush(Color.Red);
//Set paddings.
style.Padding = new PdfPaddings(5, 5, 5, 5);
//Set toc style.
toc.TitleStyle = style;
//Set toc to webkit settings.
settings.Toc = toc;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Enable toc.
settings.EnableToc = True
'Create a new instance for HTML to PDF toc.
Dim toc As New HtmlToPdfToc()
'Set title.
toc.Title = "HTML to PDF"
'Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center
'Create new HTML to PDF Toc Style.
Dim style As New HtmlToPdfTocStyle()
'Set background color.
style.BackgroundColor = New PdfSolidBrush(Color.LightCyan)
'Set font.
style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set fore color.
style.ForeColor = New PdfSolidBrush(Color.Red)
'Set paddings.
style.Padding = New PdfPaddings(5, 5, 5, 5)
'Set toc style.
toc.TitleStyle = style
'Set toc to webkit settings.
settings.Toc = toc
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
Padding
Gets or sets the padding
Declaration
public PdfPaddings Padding { get; set; }
Property Value
Type |
---|
PdfPaddings |
Examples
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
//Create a new instance for webkit converter settings.
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Enable toc.
settings.EnableToc = true;
//Create a new instance for HTML to PDF toc.
HtmlToPdfToc toc = new HtmlToPdfToc();
//Set title.
toc.Title = "HTML to PDF";
//Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center;
//Create new HTML to PDF Toc Style.
HtmlToPdfTocStyle style = new HtmlToPdfTocStyle();
//Set background color.
style.BackgroundColor = new PdfSolidBrush(Color.LightCyan);
//Set font.
style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set fore color.
style.ForeColor = new PdfSolidBrush(Color.Red);
//Set paddings.
style.Padding = new PdfPaddings(5, 5, 5, 5);
//Set toc style.
toc.TitleStyle = style;
//Set toc to webkit settings.
settings.Toc = toc;
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
'Create a new instance for webkit converter settings.
Dim settings As New WebKitConverterSettings()
'Set WebKit path
settings.WebKitPath = "/QtBinaries/"
'Enable toc.
settings.EnableToc = True
'Create a new instance for HTML to PDF toc.
Dim toc As New HtmlToPdfToc()
'Set title.
toc.Title = "HTML to PDF"
'Set title alignment.
toc.TitleAlignment = PdfTextAlignment.Center
'Create new HTML to PDF Toc Style.
Dim style As New HtmlToPdfTocStyle()
'Set background color.
style.BackgroundColor = New PdfSolidBrush(Color.LightCyan)
'Set font.
style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set fore color.
style.ForeColor = New PdfSolidBrush(Color.Red)
'Set paddings.
style.Padding = New PdfPaddings(5, 5, 5, 5)
'Set toc style.
toc.TitleStyle = style
'Set toc to webkit settings.
settings.Toc = toc
'Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings
'Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://en.wikipedia.org/wiki/.NET_Framework")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)