简体   繁体   English

剃刀pdf在mvc4中为空白

[英]razor pdf is coming blank in mvc4

I am simply trying to generate pdf in my application using razor pdf. 我只是想使用razor pdf在我的应用程序中生成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. 我按照http://www.c-sharpcorner.com/UploadFile/riyazakt/create-pdf-using-razorpdf-in-Asp-Net-mvc/的示例在我的应用程序中生成了此代码。

I followed every step as it is there. 我遵循了那里的每个步骤。

But I always get a blank pdf instead of working one. 但是我总是得到一个空白的pdf文件,而不是一个。

My configuration for this generation is- 我这一代的配置是-

Visual studio 2012/framework-4.5/MVC4 Visual Studio 2012 /框架-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; 我在网上使用razor pdf找到了所有示例; are doing their work using this manner. 用这种方式做他们的工作。 Is there any configuration change with VS2012? VS2012是否有任何配置更改?

Whereas I tried changing webpage version to- 而我尝试将网页版本更改为-

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

But that didn't help me. 但这对我没有帮助。

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. 首先,我使用MVC 4创建了相同的PDF视图,但是RazorPDF和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. 我保留了演示项目中使用的MVC版本3和相同的dll。 So that was worked for me. 这样对我有用。 I had been tried for the MVC 4 but that was not happened finally. 我已经尝试过使用MVC 4,但是最终没有实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM