c# - Add page number whle converting HTML to PDF -
i using pdf generator
http://www.nrecosite.com/pdf_generator_net.aspx
i add poge number well.
following code:
string htmlcontent = "...."; var generator=new nreco.pdfgenerator.htmltopdfconverter(); generator.orientation = nreco.pdfgenerator.pageorientation.landscape; generator.pageheaderhtml= "<img style='width:50px' src='"+httpcontext.current.server.mappath("~") +"/test.png' />"; generator.pagefooterhtml = "<h1>test </h1>"; var pdfbytes = generator.generatepdf(htmlcontent); system.io.file.writeallbytes(httpcontext.current.server.mappath("~") + "/hello2.pdf", pdfbytes);
any idea?
i added following code in html worked :)
<html> <head> <script> function subst() { var vars = {}; var x = document.location.search.substring(1).split('&'); (var in x) { var z = x[i].split('=', 2); vars[z[0]] = unescape(z[1]); } var x = ['frompage', 'topage', 'page', 'webpage', 'section', 'subsection', 'subsubsection']; (var in x) { var y = document.getelementsbyclassname(x[i]); (var j = 0; j < y.length; ++j) y[j].textcontent = vars[x[i]]; } } </script> </head> <body style="border: 0; margin: 0;" onload="subst()"> <table style="border-bottom: 1px solid black; width: 100%"> <tr> <td class="section"> </td> <td style="text-align: right"> page <span class="page"></span>of <span class="topage"></span> </td> </tr> </table> </body> </html>
Comments
Post a Comment