Render html background image using itext in asp.net -
i parsing html string build pdf file using itext in asp.net. problem not unable render background image in div tag.
html string
string data=" hello<div style='background:url(http://localhost:64744/openings.png);width:200px;height:300px;'></div>"
default.aspx
document pdfdoc = new document(pagesize.a4, 5, 5, 10, 10); system.io.memorystream mstream = new system.io.memorystream(); pdfwriter writer = pdfwriter.getinstance(pdfdoc, mstream); /*****************************/ stringwriter swpdf = new stringwriter(); htmltextwriter hwpdf = new htmltextwriter(swpdf); hwpdf.write(session["data"]); // above string stringreader sr = new stringreader(swpdf.tostring()); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); htmlparser.parse(sr); pdfdoc.close(); response.contenttype = "application/octet-stream"; response.addheader("content-disposition", "attachment; filename=cod.pdf"); response.clear(); response.outputstream.write(mstream.getbuffer(), 0, mstream.getbuffer().length); //response.binarywrite(mstream.toarray()); response.end();
everything fine pdf generated without background image. possible way background image using itext or other dll
Comments
Post a Comment