Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Could not load file or assembly 'itextsharp, Version=5.4.1.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The system cannot find the file specified.


C#
Could not load file or assembly 'itextsharp, Version=5.4.1.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The system cannot find the file specified.


C#
<asp:DropDownList ID="DropDownListDownloadCv0" runat="server">
<asp:ListItem>CV</asp:ListItem>
<asp:ListItem>PDF</asp:ListItem>
</asp:DropDownList>


C#
 protected void DownloadCv_Click(object sender, ImageClickEventArgs e)
{
{
string sDirPath = Server.MapPath("~/PDF_WORD/Docs");
var ObjSearchDir = new DirectoryInfo(sDirPath);
if (!ObjSearchDir.Exists)
{
ObjSearchDir.Create();
}
string strFileName =
HttpContext.Current.Server.MapPath("~/PDF_WORD/Docs/Test." + DropDownListDownloadCv0.SelectedValue.ToString() +
"");
var objfileinfo = new FileInfo(strFileName);
// step 1: creation of a document-object
var document = new Document();


if (objfileinfo.Exists)
{
File.Delete(strFileName);
PdfWriter.GetInstance(document, new FileStream(strFileName, FileMode.Create));
}
else
PdfWriter.GetInstance(document, new FileStream(strFileName, FileMode.Create));
// step 2:
// we create a writer that listens to the document
//StringBuilder strB = new StringBuilder();
var sw = new StringWriter();

document.Open();
var hTextWriter = new HtmlTextWriter(sw);



lblphonenumber.RenderControl(hTextWriter);
String strHtml1 = sw.ToString();


var styles = new iTextSharp.text.html.simpleparser.StyleSheet();
var hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
hw.Parse(new StringReader(strHtml1));

document.Close();

}



}
Chattkonversationen är avslutad
Posted
Comments
tumbledDown2earth 18-Apr-13 10:54am    
do you have the assembly in the application bin directory (probing path) ?
Kurac1 18-Apr-13 13:44pm    
i took add reference and added the ITextSharp.ddl , should i do anything more ?
tumbledDown2earth 18-Apr-13 23:50pm    
Make sure where you are hosting your application, there itextsharp.dll is present in the bin directory

1 solution

Could not load file or assembly 'itextsharp, Version=5.4.1.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The system cannot find the file specified.
As error states, please make sure that your have itextsharp.dll v5.4 on the system to which your project looks like is referring to.
 
Share this answer
 
Comments
Kurac1 19-Apr-13 3:31am    
I am using 5.4 still got same problem
Sandeep Mewara 19-Apr-13 10:27am    
Clear your temp files and all. Rebuild and try again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900