简体   繁体   English

无法从程序集'itextsharp,Version = 5.5.3.0,Culture = neutral,PublicKeyToken = 8354ae6d2174ddca'加载类型'iTextSharp.text.html.HtmlParser'

[英]Could not load type 'iTextSharp.text.html.HtmlParser' from assembly 'itextsharp, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca'

I am new to asp.net mvc 4. 我是asp.net mvc 4的新手。

I have done a simple application using RazorPDF. 我使用RazorPDF完成了一个简单的应用程序。

Application is to display a normal page in PDF format. 应用程序是以PDF格式显示普通页面。 I have created a new application and it is running fine .But the same thing when i am implementing in my project it is not working and giving the error as Could not load type 'iTextSharp.text.html.HtmlParser' from assembly 'itextsharp, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca'. 我已经创建了一个新的应用程序,它运行正常。但是,当我在我的项目中实现时它不起作用并且给出错误, 因为无法从程序集'itextsharp中加载类型'iTextSharp.text.html.HtmlParser', Version = 5.5.3.0,Culture = neutral,PublicKeyToken = 8354ae6d2174ddca'。

I researched about this and found the concept that why it is displaying this error , as bcoz while installing the RazorPDF it is not installing the HtmlParser inside iTextSharp. 我研究了这个,发现了为什么它显示这个错误的概念,因为bcoz在安装RazorPDF时没有在iTextSharp中安装HtmlParser。

The point I am not getting is if I am doing the same thing in newly application it is installing everything and the code is working fine,if the same i am doing in my project it is not installing all the things through i ma getting this error. 我没有得到的一点是,如果我在新应用程序中做同样的事情,它正在安装一切,并且代码工作正常,如果我在我的项目中做同样的事情,它不是通过我安装所有的东西得到这个错误。

Code is working fine ,no doubt in that.The problem is while installing the RazorPDF in my project it is not installing all the 9 subpackages inside the iTextSharp(HtmlEncoder,HtmlTags,HtmlUtilities,WebColors,HtmlParser,Markup,ITextmyHtmlHandler,HtmlWriter,HtmlTagMap) ,it is installing only 4 subpackages(HtmlEncoder,HtmlTags,HtmlUtilities,WebColors). 代码工作正常,毫无疑问。问题是在我的项目中安装RazorPDF时,它没有在iTextSharp(HtmlEncoder,HtmlTags,HtmlUtilities,WebColors,HtmlParser,Markup,ITextmyHtmlHandler,HtmlWriter,HtmlTagMap)中安装所有9个子包。 ,它只安装了4个子包(HtmlEncoder,HtmlTags,HtmlUtilities,WebColors)。

As HtmlParser have not installed it is displaying this problem ? 由于HtmlParser尚未安装,它是否显示此问题? Do anyone have knowledge in this (RazorPDF).Can any1 help me out to solve this problem ? 有没有人知道这个(RazorPDF)。可以帮我解决这个问题吗?

Coding Controller 编码控制器

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
 using pdf.Models;
 namespace pdf.Controllers
  {
   public class StudentsController : Controller
     {
         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");
         } 
   }
 }

Model 模型

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace pdf.Models
  {
    public class MarksCard
     {
        public int RollNo
         {
           get;
           set;
         }
        public string Subject
        {
         get;
         set;
        }
      public int FullMarks
        {
         get;
         set;
       }
     public int Obtained { get; set; }
   }
}

View 视图

 @model IEnumerable<pdf.Models.MarksCard>
  @{
    Layout = null;
   }
  <!DOCTYPE html>
   <html>
  <body>
     <table border="1" width='500' bordercolor="RED"><tr><td colspan="3" bgcolor="LightGreen"  
            align="center" valign="top">
         SSLC Marks Sheet 2013</td></tr><tr><td>
          @{ var rollNumber = Model.Select(z => z.RollNo).Take(1).ToArray();}
          Riyaz Akhter<br />RollNo:@rollNumber[0]</td></tr>
         <tr>
          <td bgcolor="lightblue">@Html.DisplayNameFor(moel => moel.Subject)</td>
         <td bgcolor="lightblue">@Html.DisplayNameFor(model => model.FullMarks)</td>
        <td bgcolor="lightblue">@Html.DisplayNameFor(model => model.Obtained)</td></tr>
        @{
          int total = 0;
        }
       @foreach (var item in Model)
         {
          <tr><td>@Html.DisplayFor(modelItem => item.Subject)</td>
              <td>@Html.DisplayFor(modelItem => item.FullMarks)</td>
              <td>@Html.DisplayFor(modelItem => item.Obtained)</td>
             </tr>total += item.Obtained;
       }
      <tr><td>
         </td>
          <td>
             <strong><font color="GREEN">Total</font></strong>
           </td>
         <td>@total</td></tr>
       </table>
    </body>
  </html>

Have you read this?: 你读过这个吗?:

http://forums.asp.net/t/1925729.aspx?how+to+create+pdf+file+using+razor+pdf http://forums.asp.net/t/1925729.aspx?how+to+create+pdf+file+using+razor+pdf

I believe it is what you were looking for. 我相信这正是你要找的。

暂无
暂无

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

相关问题 无法从程序集&#39;itextsharp,Version = 5.5.5.0,Culture = neutral,PublicKeyToken = 8354ae6d2174ddca&#39;加载类型&#39;iTextSharp.text.html.HtmlParser&#39; - Could not load type 'iTextSharp.text.html.HtmlParser' from assembly 'itextsharp, Version=5.5.5.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' 无法加载文件或程序集&#39;System.Web.Http.WebHost,版本= 4.0.0.0,区域性=中性,PublicKeyToken - Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken 程序集&#39;ClosedXML,Version = 0.76.0.0,Culture = neutral,PublicKeyToken = fd1eb21b62ae805b&#39;使用&#39;DocumentFormat.OpenXml, - Assembly 'ClosedXML, Version=0.76.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b' uses 'DocumentFormat.OpenXml, 无法加载文件或程序集&#39;System.Net.Http,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a&#39; - Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 无法加载文件或程序集“System.Web.Razor,版本=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35” - Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 无法加载文件或程序集“WebGrease,版本=1.5.1.25624,文化=中性,PublicKeyToken=31bf3856ad364e35”或其依赖项之一 - Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies 无法加载文件或程序集&#39;Ninject.Web,Version = 3.2.0.0,Culture = neutral,PublicKeyToken = c7192dc5380945e7&#39;或其依赖项之一 - Could not load file or assembly 'Ninject.Web, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its dependencies 无法加载文件或程序集&#39;System.Web.Razor,版本= 2.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35&#39;或其依赖项之一 - Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies 错误:无法加载文件或程序集&#39;System.Web.Mvc,版本= 3.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35&#39;或其依赖项之一 - Error: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies 无法加载文件或程序集“System.Web.Http.WebHost,版本=4.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35” - Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM