I have a website where I am displaying pdf with itextsharp in telerik radwindow. I am succeeded with displaying pdf on telerik radwindow popup. Now, I have page name and their order and need rearrange to display TOC like below with itextsharp

I have a website where I am displaying pdf with itextsharp in telerik radwindow. I am succeeded with displaying pdf on telerik radwindow popup. Now, I have page name and their order and need rearrange to display TOC like below with itextsharp

You can do this by creating a chunk separator (cf. this answer) with a tabPosition (to make the page numbers left aligned as you show in your image).
using (FileStream output = new FileStream(@"simpleToc.pdf", FileMode.Create, FileAccess.Write))
using (Document document = new Document(PageSize.A4))
{
PdfWriter writer = PdfWriter.GetInstance(document, output);
document.Open();
Chunk leader = new Chunk(new DottedLineSeparator(), 400);
Paragraph p = new Paragraph("Terms and Conditions");
p.Add(leader);
p.Add("4");
document.Add(p);
p = new Paragraph("Dental");
p.Add(leader);
p.Add("6");
document.Add(p);
p = new Paragraph("Vision");
p.Add(leader);
p.Add("7");
document.Add(p);
p = new Paragraph("Neighborhood Pharmacy");
p.Add(leader);
p.Add("8");
document.Add(p);
p = new Paragraph("Teladoc");
p.Add(leader);
p.Add("9");
document.Add(p);
p = new Paragraph("Retail Health Clinics");
p.Add(leader);
p.Add("11");
document.Add(p);
p = new Paragraph("Counseling Services");
p.Add(leader);
p.Add("12");
document.Add(p);
p = new Paragraph("Medical Bill Saver\u2122");
p.Add(leader);
p.Add("13");
document.Add(p);
p = new Paragraph("Vitamins");
p.Add(leader);
p.Add("14");
document.Add(p);
}
The result looks like this
As you called the library "iTextSharp" and only used the [iText] tag, I assume you are using iText 5.x, not 7.x. The code above has been tested using the current 5.5.14-SNAPSHOT development version.
The Chunk constructor used above is marked Obsolete:
/**
* Creates a tab Chunk.
* Note that separator chunks can't be used in combination with tab chunks!
* @param separator the drawInterface to use to draw the tab.
* @param tabPosition an X coordinate that will be used as start position for the next Chunk.
* @since 2.1.2
*/
[Obsolete]
public Chunk(IDrawInterface separator, float tabPosition) : this(separator, tabPosition, false)
But as the old iText 5.x version as a whole is in maintenance mode, there is no need to fear that it will be dropped from the assembly during further development.