找不到路径'C:\ userimage \ MAHA MITTAI.jpg'的一部分。 [英] Could not find a part of the path 'C:\userimage\MAHA MITTAI.jpg'.

查看:80
本文介绍了找不到路径'C:\ userimage \ MAHA MITTAI.jpg'的一部分。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   protected void btnPDF_Click1(object sender, ImageClickEventArgs e)
    {


        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        GridView1.AllowPaging = false;
        GridView1.DataBind();
        GridView1.RenderControl(hw);
        GridView1.HeaderRow.Style.Add("width", "15%");
        GridView1.HeaderRow.Style.Add("font-size", "10px");
        GridView1.Style.Add("text-decoration", "none");
        GridView1.Style.Add("font-family", "Arial, Helvetica, sans-serif;");
        GridView1.Style.Add("font-size", "8px");
        StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
        HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream);

        pdfDoc.Open();
       htmlparser.Parse(sr);  ///////////error came here
        pdfDoc.Close();
        Response.Write(pdfDoc);
        Response.End();
    }
    protected string GetUrl(string uploadimage)
    {
        string[] splits = Request.Url.AbsoluteUri.Split('/');
        if (splits.Length >= 2)
        {
            string url = splits[0] + "//";
            for (int i = 2; i < splits.Length - 1; i++)
            {
                url += splits[i];
                url += "/";
            }
            return url + uploadimage;
        }
        return uploadimage;
    }
}

推荐答案

引用:

找不到路径'C:\userimage \ MAHA MITTAI.jpg

Could not find a part of the path 'C:\userimage\MAHA MITTAI.jpg

的一部分这意味着图片不在该路径中,或者您没有操作权限在文件上。



请通过以下文章了解如何使用iTextSharp处理图像。

1. iTextSharp - 使用图像 [ ^ ]

2. Asp.net使用C#,VB.NET中的iTextSharp将带有图像的WebPage导出为PDF [ ^ ]

3. 如何在ASP.NET中使用C#使用iTextSharp 在PDF文档中使用图像[ ^ ]

That means either the image is not present in that path or you don't have permission to operate on the file.

Please go through the below articles to know how to deal with images using iTextSharp.
1. iTextSharp - Working with images[^]
2. Asp.net Export WebPage with Images to PDF using iTextSharp in C#, VB.NET[^]
3. How to use image in PDF document in ASP.NET with C# using iTextSharp[^]


这篇关于找不到路径'C:\ userimage \ MAHA MITTAI.jpg'的一部分。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆