see this link converting html to pdf I got this version error in webconfig let some genius find and solve the qustion.
My Model
public class Customer
{
public int CustomerID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
My Controller this is normal code
public ActionResult Index()
{
List<Customer> customers = new List<Customer>();
for (int i = 1; i <= 10; i++)
{
Customer customer = new Customer
{
CustomerID = i,
FirstName = string.Format("FirstName{0}", i.ToString()),
LastName = string.Format("LastName{0}", i.ToString())
};
customers.Add(customer);
}
return View(customers);
}
this is for pdf convert controller
public ActionResult PDF()
{
List<Customer> customers = new List<Customer>();
for (int i = 1; i <= 10; i++)
{
Customer customer = new Customer
{
CustomerID = i,
FirstName = string.Format("FirstName{0}", i.ToString()),
LastName = string.Format("LastName{0}", i.ToString())
};
customers.Add(customer);
}
return new RazorPDF.PdfResult(customers, "PDF");
}
My webconfig
<dependentAssembly>
<assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.5.0" newVersion="5.5.5.0" />
</dependentAssembly>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…