c# - how can i print a web page in asp.net -
i trying convert , download webpage pdf file, getting error download,my code here,i not have problem if remove image means no problem
protected void btnpdf_click(object sender, eventargs e) { response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=userdetails.pdf"); response.cache.setcacheability(httpcacheability.nocache); stringwriter sw = new stringwriter(); htmltextwriter hw = new htmltextwriter(sw); this.page.rendercontrol(hw); stringreader sr = new stringreader(sw.tostring()); document pdfdoc = new document(pagesize.a4, 10f, 10f, 100f, 0.0f); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); htmlparser.parse(sr); pdfdoc.close(); response.write(pdfdoc); response.end(); } <img src="images/addo.png" /> <div style="width: 382px"> <b>export webpage images pdf using itextsharp dll<br /> student result 2012-2013</b></div> <div> <asp:gridview id="gvdetails" runat="server" autogeneratecolumns="false"> <columns> <asp:boundfield datafield="userid" headertext="userid" /> <asp:boundfield datafield="username" headertext="username" /> <asp:boundfield datafield="education" headertext="education" /> <asp:boundfield datafield="location" headertext="location" /> </columns> </asp:gridview>
Comments
Post a Comment