I am trying to generate a PDF using iTextSharp in my MVC4 application. I am using an html file, fill data in it and generate the PDF. But there is a problem rendering ordered list of type = "a". the code is something like below:
<ol style="font-size: 10px">
<li>First</li>
<li>Second</li>
<li>Third
<ol type="a">
<li>3.1</li>
<li>3.2</li>
</ol>
</li>
<li>Fourth</li>
</ol>
This should be displayed like below:
1. First
2. Second
3. Third
a. 3.1
b. 3.2
4. Fourth
But it is shown as:
1. First
2. Second
3. Third
1. 3.1
2. 3.2
4. Fourth
Even if I remove the nesting and just try to render a ordered list of type "a" like below:
<ol type="a">
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
still the list shown in PDF is like:
1. First
2. Second
3. Third
there should be a, b, c... instead of 1, 2, 3....
Is it a known issue of iTextSharp?
Is there any solution to the problem??
Thanks.
Edit: the code to generate PDF in controller is:
public ActionResult GeneratePDF()
{
var myObject = new MyClass
{
Property1 = Session["Property1"].ToString(),
.....
};
return ViewPdf("", "MyPDF", myObject);
}
where MyPDF is the html page to be rendered.
@model MyProject.ViewModel.MyPdfViewModel
@{
ViewBag.Title = "Result PDF";
}
<br />
<br />
<div>
<h2 align="center">
<u>Details</u>
</h2>
<div align="justify">
<p align="justify" style="font-size: 10px">
Below is the list
</p>
<ol style="font-size: 10px">
<li>First
</li>
<li>Second
</li>
<li>Third
<ol type="a">
<li>3.1
</li>
<li>3.2
</li>
</ol>
</li>
</ol>
</div>