c# - How to increase the table height from the code behind file in ASP.Net while using StringWriter? -


i generating 1 pdf code behind file using stringwriter , htmltextwriter. coding given below:

system.io.stringwriter sw = new system.io.stringwriter(); htmltextwriter hw = new htmltextwriter(sw); gridview gv = new gridview(); gv.borderstyle = borderstyle.none;  gv.datasource = dt2; gv.databind(); gv.rendercontrol(hw); string str = sw.tostring(); string str1 = "<table width='100%' border='1'><tr><td><img src='" + server.mappath("app_themes/ribo/ribologo.bmp") + "' alt='' width=75px height=75px /></td><td align='center' colspan='8' font size='3'><h2><b>material receipt cum inspection report(mrir)</b></h2</td></tr>"; str1 += "<tr><td font size='3'>mrir no</td><td font size='3'>date</td><td align='center' font size='3'>job description</td><td font size='3'>supplier name</td><td font size='3'>dc no</td><td font size='3'>date</td><td font size='3'>lwb no/date</td><td font size='3'>invoice no</td><td font size='3'>date</td></tr>"; str1 += "<tr><td font size='3'>" + txtmrvnumber.text + "</td><td font size='3'></td><td font size='3'></td><td font size='3'>" + tdssvendor.text + "</td><td font size='3'>" + txtdcnumber.text + "</td><td font size='3'></td><td font size='3'>" + txtlwbno.text + "</td><td font size='3'>" + txtinvoiceno.text + "</td><td font size='3'></td></tr>"; str1 += "<tr><td rowspan='2' font size='3'>description</td><td font size='3' colspan='2' align='center'>size(mm)</td><td colspan='6'></td></tr>"; str1 += "<tr><td font size='3' colspan='2'>" + sw + "</td><td colspan='6'></td></tr></table>";             if (str.startswith("<div>")) {     str = str1; } system.io.stringreader sr = new system.io.stringreader(str); itextsharp.text.document pdfdoc = new itextsharp.text.document(itextsharp.text.pagesize.a3.rotate(), 40f, 10f, 40f, 2f); itextsharp.text.html.simpleparser.htmlworker htmlparser = new itextsharp.text.html.simpleparser.htmlworker(pdfdoc); itextsharp.text.pdf.pdfwriter.getinstance(pdfdoc, response.outputstream); 

here, generated desired pdf. table displaying @ top of pdf. want display @ centre of pdf want increase height of table. how this?

i tried below:

 string str1 = "<table **height='100%'** width='100%' border='1'><tr>..... 

but displays same. how increase height of table? need suggestions please.

that alone not going it. can wrap generated .pdf in table (1 row, 1 column), , place table in sole td of new table, vertical align (valign='middle') enclosing td.

this way know how asking, although not know if work you:

     <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">         <html xmlns="http://www.w3.org/1999/xhtml">         <head>             <title>untitled page</title>  <!-- put on presentation page -->             <style type="text/css">                 html, body {                     margin: 0;                     padding: 0;                     height: 100%;                     border: none;                 }             </style>         </head>         <body>             <table style="height: 100%" width="100%" align="center">                 <tr>                     <td valign="middle" align="center">                           <table>                             <tr>                                 <td valign="middle">                                 <!-- embed .pdf here -->                                 </td>                             </tr>                         </table>                     </td>                 </tr>             </table>         </body>         </html> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -