本文介绍了如何使用ITextSharp将图像从HTML显示为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); pnlPerson.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); 在我的页面中使用In my Page i Used<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/enam.jpg" />我想将此图像转换为pdf。但我发现ERROR And i want to convert this image to pdf. But I found ERROR "Could not find a part of the path 'C:\Images\enam.jpg'. 请帮助我"Please Help Me推荐答案 这篇关于如何使用ITextSharp将图像从HTML显示为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 14:07