Please help again.
how do i export image below along with the gridview which is in the same div?
Error Could not find a part of the path
<div class="div_width" id="DivToPrint" runat="server">
<img src="~/image/uum_mini.JPG" runat="server"/>
The c# code is as i posted before. please help.i'm desperately need help.
<div class="div_width" id="DivToPrint" runat="server">
<div style="text-align: center; width: 90%; padding-bottom: 3px">
<img src="~/image/uum_mini.JPG" runat="server" />
</div>
<br />
<br />
<table id="heading" class="table_stylePageISO" runat="server">
<tr>
<td>
<div>
<asp:Label ID="lbltajuk" runat="server">INTERNAL QUALITY AUDIT REPORTING MS ISO 9001:2015</asp:Label><br />
<br />
<asp:Label ID="lbltitle" runat="server">REPORT BY GROUP</asp:Label>
</div>
</td>
</tr>
</table>
<table style="width: 100%">
<tr>
<td>
<asp:GridView ID="gvSiriAudit" runat="server" OnRowDataBound="gvSiriAudit_RowDataBound" OnPreRender="gvAuditPlanSearch_PreRender"
AutoGenerateColumns="False" ShowHeaderWhenEmpty="true" DataKeyNames="kod_kump">
<%--OnDataBound="gvSiriAudit_DataBound"--%>
<EmptyDataRowStyle HorizontalAlign="Center" ForeColor="Red" />
<EmptyDataTemplate>
<strong><span>NO DATA</span></strong>
</EmptyDataTemplate>
<%--<AlternatingRowStyle BackColor="#dedede"></AlternatingRowStyle>--%>
<Columns>
<asp:BoundField HeaderText="GROUP" DataField="kump_desc" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:TemplateField HeaderText="NAME" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="350px">
<ItemTemplate>
<asp:GridView ID="gvStaffName" runat="server" ShowHeader="false" Width="100%">
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="CLAUSE" DataField="clause_desc"></asp:BoundField>
<asp:BoundField HeaderText="PROCESS" DataField="process_desc" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField HeaderText="SUBPROCESS" DataField="subprocess_desc" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField HeaderText="DEPARTMENT" DataField="PTJDesc"></asp:BoundField>
</Columns>
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
</asp:GridView>
</td>
</tr>
</table>
</div>
Document doc = new Document(PageSize.A4.Rotate(), 30f, 30f, 30f, 30f);
PdfWriter.GetInstance(doc, Response.OutputStream);
doc.Open();
for (int i = 0; i < gvSiriAudit.PageCount; i++)
{
//Set the Page Index.
gvSiriAudit.PageIndex = i;
//Hide Page as not needed in PDF.
gvSiriAudit.PagerSettings.Visible = false;
//Populate the GridView with records for the Page Index.
this.BindGridSiriAudit();
//Render the GridView as HTML and add to PDF.
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
DivToPrint.RenderControl(hw);
HTMLWorker htmlparser = new HTMLWorker(doc);
StringReader sr = new StringReader(sw.ToString());
gvSiriAudit.HeaderStyle.ForeColor = System.Drawing.Color.White;
htmlparser.Parse(sr);
}
}
//Add a new Page to PDF document.
doc.NewPage();
}
doc.Close();
Response.ContentType = "Application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=GridviewExport.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(doc);
Response.End();