I have a panel that contains a repeater control with employee info and an image. When i want to export to a PDF then I get the following error:System.UriFormatException: System.Net.WebException: 'Could not find a part of the path 'C:\images\img_who-we-are_logo.png'.'
Protected Sub btnCreatePDF_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As StringWriter = New StringWriter()
Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
imgLogo.Visible = True
PanelEmployeeMedicalHistory.RenderControl(hw)
imgLogo.Visible = False
Dim sr As StringReader = New StringReader(sw.ToString())
Dim pdfDoc As Document = New Document(PageSize.A2, 10.0F, 10.0F, 100.0F, 0.0F)
Dim htmlparser As HTMLWorker = New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
htmlparser.Parse(sr)
pdfDoc.Close()
Response.Write(pdfDoc)
Response.End()
End Sub
This is my code for my image:
<asp:Image ID="ImgLogo" runat="server" ImageUrl="~/images/img_who-we-are_logo.png" />