razor pdf is coming blank in mvc4

636 Views Asked by At

I am simply trying to generate pdf in my application using razor pdf.

I followed http://www.c-sharpcorner.com/UploadFile/riyazakt/create-pdf-using-razorpdf-in-Asp-Net-mvc/ example for generating this in my application.

I followed every step as it is there.

But I always get a blank pdf instead of working one.

My configuration for this generation is-

Visual studio 2012/framework-4.5/MVC4

Code-

public ActionResult Index()
    {
        var studentMarks = new List<MarksCard>()
    {
       new MarksCard()
        {
            RollNo = 101, Subject = "C#",
            FullMarks = 100, Obtained = 90},new MarksCard() {RollNo = 101, Subject = "asp.net", FullMarks = 100, Obtained = 80},new MarksCard() {RollNo =               101, Subject = "MVC", FullMarks = 100,
            Obtained = 100},new MarksCard() {RollNo = 101, Subject = "SQL Server", FullMarks = 100, Obtained = 75},
    };
        return new RazorPDF.PdfResult(studentMarks, "Index");
    }

I found all examples on internet using razor pdf; are doing their work using this manner. Is there any configuration change with VS2012?

Whereas I tried changing webpage version to-

<add key="webpages:Version" value="1.0" />

But that didn't help me.

1

There are 1 best solutions below

0
On

I found the same error there. Firstly I have created the same PDF view using MVC 4 but there was some versioning issues with RazorPDF and MVC. So I have downloaded the same project as you have mentioned above. I keep MVC version 3 and same dll that have been used in the demo project. So that was worked for me. I had been tried for the MVC 4 but that was not happened finally.