I want to convert my aspx page to pdf

Aug 30 2013 9:32 AM
Hi al,
       i want to convert my aspx page to pdf document by passing url with applied styles.....my task is when i pass url of my invoicepage.aspx which will be having datalist...labels and inline styles in the td table etc..i need to change them all to the exact format with all styles i included with that... to pdf doc....but am not able to get the desired output...could yo please help me am using "itextsharp.dll" for this.....version 5.4.3
i could not able to use Xml parser am getting compilation error i dnt knw whre am gng wrong...!! i will list my all coding here please review i will be very thank ful to u i have been stuck for weeks...."Its working but without proper alignment"

#########################################Default.aspx

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using iTextSharp.text;
using System.Net;
using iTextSharp.text.pdf;
using iTextSharp.text.html.simpleparser;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      GetWebHtmlSourceCode("http://localhost:9168/InvoicePDF.aspx");
    }

    public static void GetWebHtmlSourceCode(string url)
    {
        string Content = "";
        StreamReader objStreamReader = default(StreamReader);
        WebRequest objWebRequest = default(WebRequest);
        WebResponse objWebResponse = default(WebResponse);
        objWebResponse.ContentType = "application/pdf";

        try
        {
            objWebRequest = WebRequest.Create(url);
            objWebResponse = objWebRequest.GetResponse();
            objStreamReader = new StreamReader(objWebResponse.GetResponseStream());
            Content = objStreamReader.ReadToEnd();
            objStreamReader.Close();
            string filename = AppDomain.CurrentDomain.BaseDirectory + "Invoice.pdf";
            Document document = new Document(PageSize.A4, 80, 50, 30, 65);
            using (FileStream fs = new FileStream(filename, FileMode.Create))
            {
                PdfWriter.GetInstance(document, fs);
                using (StringReader stringReader = new StringReader(Content))
                {
                    PdfWriter writer = PdfWriter.GetInstance(document, fs);
                    document.Open();
                    HTMLWorker htmlparser = new HTMLWorker(document);
                    htmlparser.Parse(new StringReader(Content));
                    
                    //XMLWorkerHelper i getting error "does not exist"
                    //so i used HTMLWorker
                    //XMLWorkerHelper.GetInstance().ParseXHtml(
                    //writer, document, html
                    //);
                   
                    document.Close();
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }



******************************************************************



#####################################Invoice.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
  
</head>
<body style="margin:0 0 0 0">
    <form id="form1" runat="server">
    <div>
    <table cellpadding="0" cellspacing="0" width="100%" style="padding:0px 0px 0px 0px;">
     <tr>
     <td>
     <table cellpadding="0" cellspacing="0" width="100%">
     <tr>
     <td>
      <table cellpadding="0" cellspacing="0" width="100%">
       <tr>
       <td style="width:20%"><img id="logo" runat="server"  alt="" /></td>
       <td style="width:50%" valign="top">
           <table cellpadding="0" cellspacing="0" width="100%">
               <tr>
                   <td style="height: 30px;" align="center">
                       <asp:Label ID="lblSubjectToApproval" runat="server" Font-Names="Calibri" Font-Size="18px" Font-Bold="true" Text="**Subject To Approval**" Visible="false"></asp:Label>
                   </td>
               </tr>
               <tr>
                   <td style="height: 30px;">
                       <asp:Label ID="lblHeaderCompanyName" runat="server" Font-Names="Calibri" Font-Size="18px" Font-Bold="true"></asp:Label>
                   </td>
               </tr>
               <tr>
                   <td>
                       <asp:Label ID="lblHeaderAddress1" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                   </td>
               </tr>
               <tr>
                   <td>
                       <asp:Label ID="lblHeaderAddress2" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                   </td>
               </tr>
               <tr>
                   <td>
                       <asp:Label ID="lblHeaderAddress3" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                   </td>
               </tr>
           </table>
       </td>
       <td style="width:30%;"  valign="top">
     
       <table cellpadding="0" cellspacing="0" width="100%">
                         <tr>
                         <td colspan="2" style="padding-left:30px;height:30px;"> <asp:Label ID="lblInvoiceTitle" runat="server" Font-Names="Calibri" Font-Size="20px" Font-Bold="true"></asp:Label>
                             <asp:Label ID="lblTest" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;width:45%;font-family: Calibri;font-weight: bold;font-size: 12px;" align="left" >
                             <asp:Label ID="lblCreditNoteLabel" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                             <td style="width:55%;" align="left">
                             <asp:Label ID="lblCreditNoteNo" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                             <asp:Label ID="lblInvoiceMonthLabel" runat="server" Font-Names="Calibri" Font-Size="12px" Text="Invoice Month"></asp:Label>&nbsp;&nbsp;
                                 &nbsp;&nbsp;
                             </td>
                             <td  align="left">
                             <asp:Label ID="lblInvoiceMonth" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                                 <asp:Label ID="lblInvoiceDateLabel" runat="server" Font-Names="Calibri" Font-Size="12px" Text="Invoice Date"></asp:Label>&nbsp;&nbsp;
                             </td>
                             <td  align="left">
                             <asp:Label ID="lblInvoiceDate" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                              Lease ID&nbsp;&nbsp;
                             </td>
                             <td align="left">
                             <asp:Label ID="lblLeaseDisplayId" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                             <asp:Label ID="lblInvoiceDisplayIdLabel" runat="server" Font-Names="Calibri" Font-Size="12px" Text="Invoice #"></asp:Label>
                             &nbsp;&nbsp;
                             </td>
                             <td align="left">
                                 <asp:Label ID="lblInvoiceDisplayId" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                         <tr>
                             <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                             <asp:Label ID="lblPaymentDueDateLabel" runat="server" Font-Names="Calibri" Font-Size="12px" Text="Payment Due on"></asp:Label>
                             &nbsp;&nbsp;
                             </td>
                             <td align="left">
                                 <asp:Label ID="lblPaymentDueDate" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                             </td>
                         </tr>
                     </table>
      
       </td>       
       </tr>      
       </table>   
     </td>
     </tr>
     <%--<tr>
     <td align="right">
         <table cellpadding="0" cellspacing="0" width="100%">
             <tr>
                 <td style="width: 60%">
                 </td>
                 <td style="width: 40%">
                    
                 </td>
             </tr>
         </table>
     </td>
     </tr>
     <tr>
     <td>&nbsp;</td>
     </tr>--%>
     <tr>
     <td style="padding-top:5px;">
      <table cellpadding="0" cellspacing="0" width="100%">
      <%--<tr>
                            <td style="width: 70%" align="left" colspan ="3" valign="top">
                            <table cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                            <td class="InvoiceTextHead" style="width:8%" valign="top">
                            Attention :
                            </td>
                            <td style="width:92%" valign="top">
                            <asp:Label ID="lblAttention" runat="server" CssClass="InvoiceText"></asp:Label>
                            </td>
                            </tr>
                            </table>
                              
                            </td>
                        </tr>--%>
      <tr>    
      <td style="width:70%">
          <table cellpadding="0" cellspacing="0" width="100%">
              <tr>
                  <td style="width: 10%;font-family:Calibri;font-size:12px;font-weight:bold;" valign="top">                     
                          Invoice To
                  </td>
                  <td style="width: 90%" valign="top">
                      <asp:Label ID="lblClientName" runat="server" Font-Names="Calibri" Font-Bold="true" Font-Size="12px"></asp:Label>
                  </td>
              </tr>
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td align="left">
                      <asp:Label ID="lblClientAddress1" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                  </td>
              </tr>
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td align="left">
                      <asp:Label ID="lblClientAddress2" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                  </td>
              </tr>
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td align="left">
                      <asp:Label ID="lblClientAddress3" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                  </td>
              </tr>
          </table>
      </td>     
      <td style="width:30%" valign="top">
      <table cellpadding="0" cellspacing="0" width="100%">
               <tr>
                    <td style="height: 20px;width:45%;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                                Shop #&nbsp;&nbsp;
                   </td>
                   <td style="height: 25px;width:55%" align="left">
                     <asp:Label ID="lblUnits" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                   </td>                  
               </tr>
               <tr>
                <td style="height: 20px;font-family:Calibri;font-size:12px;font-weight:bold;" align="left">
                                Shop Name&nbsp;&nbsp;
                   </td>
                   <td  align="left">
                      <asp:Label ID="lblClientBrand" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                   </td>
               </tr>             
           </table>
      </td>
      </tr>
      </table>
    
     </td>
     </tr>
     <tr>
     <td>&nbsp;</td>
     </tr>
     <tr>
     <td>
    
         <asp:GridView ID="gvInvoice" runat="server" Width="100%" AutoGenerateColumns="False"
             GridLines="None" HeaderStyle-BackColor="Black" HeaderStyle-Font-Names="Calibri" HeaderStyle-Font-Size="12px" RowStyle-Font-Names="Calibri" RowStyle-Font-Size="12px">
             <Columns>
                 <asp:BoundField DataField="desc1" HeaderText="Description" ItemStyle-Height="22"
                     HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                 <asp:BoundField DataField="rentablearea" HeaderText="Chargeable Area" HeaderStyle-HorizontalAlign="Left">
                 </asp:BoundField>
                 <asp:BoundField DataField="rent" DataFormatString="{0:n}" HeaderText="Rate" HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="center" />
                     <ItemStyle HorizontalAlign="center" />
                 </asp:BoundField>
                 <asp:BoundField DataField="days" HeaderText="Day(s)" ItemStyle-HorizontalAlign="Center">
                 </asp:BoundField>
                 <asp:BoundField DataField="baserent" HeaderText="Amount in INR" DataFormatString="{0:n}"
                     HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="Right" />
                     <ItemStyle HorizontalAlign="Right" />
                 </asp:BoundField>
             </Columns>
             <HeaderStyle BackColor="#000000" ForeColor="#ffffff" BorderColor="#000000" Height="20px" BorderWidth="1px"/>
         </asp:GridView>
         <asp:GridView ID="gvInterestInvoice" runat="server"  Width="100%" AutoGenerateColumns="False"
             GridLines="None" RowStyle-Font-Names="Calibri" RowStyle-Font-Size="12px">
             <Columns>
                 <asp:BoundField DataField="desc1" HeaderText="Description" ItemStyle-Height="22"
                     HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                 <asp:BoundField DataField="rentablearea" HeaderText="Chargeable Area" Visible="false" HeaderStyle-HorizontalAlign="Left">
                 </asp:BoundField>
                 <asp:BoundField DataField="rent" DataFormatString="{0:n}" Visible="false" HeaderText="Rate" HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="center" />
                     <ItemStyle HorizontalAlign="center" />
                 </asp:BoundField>
                 <asp:BoundField DataField="days" HeaderText="Day(s)" ItemStyle-HorizontalAlign="Center">
                 </asp:BoundField>
                 <asp:BoundField DataField="DueAmount" HeaderText="Due Amount" DataFormatString="{0:n}">
                     <HeaderStyle HorizontalAlign="Right" />
                     <ItemStyle HorizontalAlign="Right" />
                 </asp:BoundField>
                 <asp:BoundField DataField="total_percentage" HeaderText="Interest Percentage" HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="Right" />
                     <ItemStyle HorizontalAlign="Right" />
                 </asp:BoundField>
                 <asp:BoundField DataField="baserent" HeaderText="Amount in INR" DataFormatString="{0:n}"
                     HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="Right" />
                     <ItemStyle HorizontalAlign="Right" />
                 </asp:BoundField>
             </Columns>
             <HeaderStyle BackColor="#000000" ForeColor="#ffffff" BorderColor="#000000" Height="20px" BorderWidth="1px"/>
         </asp:GridView>
         <asp:Panel ID="Panel1" runat="server" Width="100%">
         <table cellpadding="0" cellspacing="0" width="100%">
         <tr>
         <td class="InvoiceGridHead InvoiceText" style="width:35%;" align="center">Description</td>
         <td class="InvoiceGridHead InvoiceText" style="width:10%;" align="center">Reading</td>
         <td class="InvoiceGridHead InvoiceText" style="width:6%;" align="center">MF</td>
         <td class="InvoiceGridHead InvoiceText" style="width:10%;" align="center">Units Consumed</td>
         <td class="InvoiceGridHead InvoiceText" style="width:8%;" align="center">Total units</td>
         <td class="InvoiceGridHead InvoiceText" style="width:7%;" align="center">Chargeable Area</td>
         <td class="InvoiceGridHead InvoiceText" style="width:7%;" align="center">Carpet Area</td>        
         <td class="InvoiceGridHead InvoiceText" style="width:7%;" align="center">Rate / Amount</td>
         <td class="InvoiceGridHead InvoiceText" style="width:10%;" align="center">Amount  in INR</td>
         </tr>
         <tr>
         <td colspan="9">
             <asp:DataList ID="dlMCInvoice" runat="server" Width="100%"
                 OnItemDataBound="dlMCInvoice_ItemDataBound" ItemStyle-Font-Names="Calibri" Font-Size="12px">
                 <ItemTemplate>
                     <table cellpadding="0" cellspacing="0" width="100%">
                         <tr>
                             <td style="width: 35%; height: 25px;" align="left">
                                 <b>
                                     <%#Eval("desc1") %></b>
                             </td>
                             <td style="width: 10%;" align="center">
                                 <%#Eval("Reading")%>
                             </td>
                             <td style="width: 6%;">
                                 &nbsp;
                             </td>
                             <td style="width: 10%;" align="center">
                                 <%#Eval("unitsconsumed")%>
                             </td>
                             <td style="width: 8%;">
                                 &nbsp;
                             </td>
                             <td style="width: 7%;" align="center">
                                 <%#Eval("chargeablearea")%>
                             </td>
                             <td style="width: 7%;" align="center">
                                 <%#Eval("carpetarea")%>
                             </td>
                             <td style="width: 7%;" align="center">
                                 <asp:Label ID="lblRate" runat="server" Text='<%#string.Format("{0:0.00}",Convert.ToDouble(DataBinder.Eval(Container.DataItem, "rate").ToString()))%>'
                                     Visible='<%#(DataBinder.Eval(Container.DataItem, "visible").ToString()=="0")?false:true%>' />
                             </td>
                             <td style="width: 10%;" align="right">
                                 <asp:Label ID="Label2" runat="server" Text='<%#string.Format("{0:0,0.00}",Convert.ToDouble(DataBinder.Eval(Container.DataItem, "amount").ToString()))%>'
                                     Visible='<%#(DataBinder.Eval(Container.DataItem, "visible").ToString()=="0")?false:true%>' />
                             </td>
                         </tr>
                         <tr>
                             <td colspan="9">
                                 <asp:DataList ID="dlInner" runat="server" Width="100%"  ItemStyle-Font-Names="Calibri" Font-Size="12px" OnItemDataBound="dlInner_ItemDataBound">
                                     <ItemTemplate>
                                         <table cellpadding="0" cellspacing="0" width="100%" runat="server" id="tbInner">
                                             <tr>
                                                 <td style="width: 20%; height: 20px;" align="left">
                                                     <%#Eval("desc1") %>
                                                 </td>
                                                 <td style="width: 15%;" align="right">
                                                     Opening Reading
                                                 </td>
                                                 <td style="width: 10%;" align="center">
                                                     <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("OpeningReading")))%>
                                                 </td>
                                                 <td style="width: 6%;" rowspan="2" align="center">
                                                    <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("multiplyingfactor")))%>
                                                 </td>
                                                 <td style="width: 10%;" align="center" rowspan="2">
                                                     <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("unitsconsumed")))%>
                                                 </td>
                                                 <td style="width: 8%;" align="center" rowspan="2">
                                                     <%#string.Format("{0:0.00}", Convert.ToDouble(DataBinder.Eval(Container.DataItem, "totalunits").ToString()))%>
                                                 </td>
                                                 <td style="width: 14%;" align="center" rowspan="2">
                                                     <%#Eval("chargeablearea")%>
                                                 </td>
                                                 <td style="width: 7%;" align="center" rowspan="2">
                                                     <%#string.Format("{0:0.00}",Convert.ToDouble(DataBinder.Eval(Container.DataItem, "rate").ToString()))%>
                                                 </td>
                                                 <td style="width: 10%;" align="right" rowspan="2">
                                                     <%#string.Format("{0:0,0.00}",Convert.ToDouble(DataBinder.Eval(Container.DataItem, "amount").ToString()))%>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td style="padding-bottom: 10px;">
                                                     &nbsp;
                                                 </td>
                                                 <td align="right">
                                                     Closing Reading
                                                 </td>
                                                 <td align="center">
                                                     <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("ClosingReading")))%>
                                                 </td>
                                             </tr>                                           
                                             <tr>
                                                 <td style="padding-bottom: 10px;">
                                                     &nbsp;
                                                 </td>
                                                 <td align="right">
                                                     <asp:Label ID="lbl1" runat="server" Visible='<%#Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "fuel").ToString()) %>'
                                                         Text="P & T Charges"></asp:Label>
                                                 </td>
                                                
                                                 <td align="center">
                                                     <asp:Label ID="Label3" runat="server" Text='<%#string.Format("{0:0.00}", Convert.ToDouble(DataBinder.Eval(Container.DataItem, "fueladjustments").ToString()))%>'
                                                         Visible='<%#Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "fuel").ToString()) %>'></asp:Label>
                                                 </td>
                                                 <td align="center">
                                                     &nbsp;
                                                 </td>
                                                 <td align="center">
                                                     &nbsp;
                                                 </td>
                                                 <td align="center">
                                                     &nbsp;
                                                 </td>
                                                 <td align="center">
                                                     &nbsp;
                                                 </td>
                                                 <td align="center">
                                                     &nbsp;
                                                 </td>   
                                                  <td align="center">
                                                     &nbsp;
                                                 </td>                                              
                                             </tr>                                                             
                                            
                                             <tr>                                               
                                                <td colspan="2" align="right" style="height:25px;">
                                                     Meter Hier Charge
                                                 </td>
                                                 <td colspan="5">&nbsp;</td>
                                                 <td align="center">
                                                   <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("meterhirecharge")))%>
                                                 </td>
                                                 <td>&nbsp;</td>
                                             </tr>                                                                         
                                              <tr>                                               
                                                <td colspan="2" align="right"  style="height:25px;">
                                                     Fixed Load Charge
                                                 </td>
                                                 <td colspan="5">&nbsp;</td>
                                                 <td align="center">
                                                   <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("fixedloadcharge")))%>
                                                 </td>
                                                 <td>&nbsp;</td>
                                             </tr> 
                                              <tr>                                               
                                                <td colspan="2" align="right" style="height:25px;">
                                                     Duty
                                                 </td>
                                                 <td colspan="5">&nbsp;</td>
                                                 <td align="center">                                                    
                                                   <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("duty")))%>
                                                 </td>
                                                 <td>&nbsp;</td>
                                             </tr> 
                                              <tr>                                               
                                                <td colspan="2" align="right" style="height:25px;">
                                                     Cess
                                                 </td>
                                                 <td colspan="5">&nbsp;</td>
                                                 <td align="center">
                                                   <%#string.Format("{0:0.00}", Convert.ToDouble(Eval("cess")))%>
                                                 </td>
                                                 <td>&nbsp;</td>
                                             </tr> 
                                         </table>
                                     </ItemTemplate>
                                 </asp:DataList>
                             </td>
                         </tr>
                     </table>
                 </ItemTemplate>
             </asp:DataList>
         </td>
         <td>
        
         </td>
         </tr>
         </table>
         </asp:Panel>       
    
     </td>    
     </tr>
     <tr>
     <td style="background-color:#d8d8d8;" align="right">  
     <table cellpadding="0" cellspacing="0" width="100%" Id="Table"  runat="server">
             <tr>
                 <td style="width: 65%;height:25px;" align="left">
                    
                 </td>
                 <td style="width: 25%;" align="right">
                     <asp:Label ID="lblProdateInformation" runat="server" Font-Names="Calibri" Font-Size="12px" Font-Bold="true" />
                 </td>
                 <td style="width: 10%" align="right">
                     <asp:Label ID="lblProdateAmount" runat="server" Font-Names="Calibri" Font-Size="12px" Font-Bold="true" />
                 </td>
             </tr>
         </table>
           </td>
     </tr>
    <tr>
     <td style="background-color:#d8d8d8;height:25px;" align="right">
         <table cellpadding="0" cellspacing="0" width="25%" style="font-family:Calibri;font-size:12px;font-weight:bold;">
             <tr>
                 <td style="width:60%" align="right">Sub Total
                 </td>
                 <td style="width:40%" align="right">
                 <asp:Label ID="lblSubTotal" runat="server" Font-Names="Calibri" Font-Bold="true" Font-Size="12px" />
                 </td>
             </tr>
         </table>
     </td>
     </tr>
     <tr>
     <td style="background-color:#d8d8d8;" align="right">
        <table cellpadding="0" cellspacing="0" width="25%" style="font-family:Calibri;font-size:12px;font-weight:bold;" id="TaxTable" runat="server">
             <tr>
                 <td style="width:60%" align="right"><asp:Label ID="lblServiceTaxTotalHead" runat="server" Font-Names="Calibri" Font-Size="12px" Font-Bold="true" />
                 </td>
                 <td style="width:40%" align="right">
                 <asp:Label ID="lblServiceTaxTotal" runat="server" Font-Names="Calibri" Font-Size="12px" Font-Bold="true" />
                 </td>
             </tr>
         </table>
         <asp:GridView ID="gvTax" runat="server"  ItemStyle-Font-Names="Calibri" Font-Size="12px" Width="30%" AutoGenerateColumns="False"           
             GridLines="None" ShowHeader="False">
             <Columns>
                 <asp:BoundField DataField="text" HeaderText="Description">                   
                <ItemStyle Height="20px" HorizontalAlign="Right" Width="70%"></ItemStyle>
                 </asp:BoundField>
                 <asp:BoundField DataField="tax" HeaderText="Amount in INR" DataFormatString="{0:n}"
                     HtmlEncode="False">
                     <HeaderStyle HorizontalAlign="Right" />
                     <ItemStyle HorizontalAlign="Right" Width="30%" />
                 </asp:BoundField>
             </Columns>
             <HeaderStyle BackColor="#000000" ForeColor="#ffffff" BorderColor="#000000" Height="20px" BorderWidth="1px" />
         </asp:GridView>
        
     </td>
     </tr>
     <tr>
     <td style="background-color:#000000;height:25px;">
        <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
        <td style="width:65%" align="left">
        <asp:Label ID="lblTotalinWords" runat="server" ForeColor="White"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true" ></asp:Label>
        </td>
        <td style="width:25%" align="right"><asp:Label ID="lblTotalCaption" runat="server"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true"  ForeColor="White" Text="Total payable before due date"/></td>
        <td style="width:10%" align="right"><asp:Label ID="lblTotal" runat="server"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true"   ForeColor="White"/></td>
        </tr>
        </table>
       
     </td>
     </tr>
     <tr>
     <td>
     <asp:Label ID="lblCreditNoteInfo" runat="server" Font-Names="Calibri" Font-Size="12px"/>
     </td>
     </tr>       
      <tr>
     <td style="padding-top:10px;">
     <asp:Panel ID="PanelDescInvoice" runat="server">
         <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">
             <tr>
                 <td style="height: 20px;" valign="top">
                 1.&nbsp;
                 </td>
                 <td valign="top">
                  Payment can be made by RTGS to <asp:Label ID="lblDescription1" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
             </tr>
             <tr>
                 <td style="height: 20px;" valign="top">
                 2.&nbsp;
                 </td>
                 <td valign="top"> Cheque/DD should be in Favour of <asp:Label ID="lblDescription2" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>.
                 </td>
             </tr>
              <tr>
                 <td style="height: 20px;" valign="top">
                 3.&nbsp;
                 </td>
                 <td valign="top"> Amount billed to be settled by due date<asp:Label ID="lblDescriptionDays" runat="server" Font-Names="Calibri" Font-Size="12px" Visible="false" />. Delay in payment will attract interest as per the
                                 lease agreement and other penal provisions
                 </td>
              </tr>           
               <tr>
                 <td style="height: 20px;" valign="top">
                 4.&nbsp;
                 </td>
                 <td valign="top"> For any further assistance or information, please contact: <br />
                 <asp:Label ID="lblInfoName" runat="server" Font-Names="Calibri" Font-Size="12px" Font-Bold="true"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress1" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress2" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />                
                 Email: <asp:Label ID="lblInfoEmail" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Contact: <asp:Label ID="lblInfoContact" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Mobile: <asp:Label ID="lblInfoMobile" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
                 </tr>
         </table>
         </asp:Panel>
         <asp:Panel ID="PanelInterestInvoice" runat="server">
         <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">
             <tr>
                 <td style="height: 20px;" valign="top">
                 1.&nbsp;
                 </td>
                 <td valign="top">
                  Payment can be made by RTGS to <asp:Label ID="lblDescription1_Interest" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
             </tr>
             <tr>
                 <td style="height: 20px;" valign="top">
                 2.&nbsp;
                 </td>
                 <td valign="top"> Cheque/DD should be in Favour of <asp:Label ID="lblDescription2_Interest" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>.
                 </td>
             </tr>
                      
               <tr>
                 <td style="height: 20px;" valign="top">
                 3.&nbsp;
                 </td>
                 <td valign="top"> For any further assistance or information, please contact: <br />
                 <asp:Label ID="lblInfoName_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress1_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress2_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />                
                 Email: <asp:Label ID="lblInfoEmail_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Contact: <asp:Label ID="lblInfoContact_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Mobile: <asp:Label ID="lblInfoMobile_Interest" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
                 </tr>
         </table>
         </asp:Panel>
         <asp:Panel ID="PanelDescCreditNote" runat="server">
             <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">
                 <tr>
                 <td style="height: 20px;" valign="top">
                 1.&nbsp;
                 </td>
                 <td valign="top"> For any further assistance or information, please contact: <br />
                 <asp:Label ID="lblInfoName_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress1_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 <asp:Label ID="lblInfoAddress2_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />                
                 Email: <asp:Label ID="lblInfoEmail_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Contact: <asp:Label ID="lblInfoContact_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label><br />
                 Mobile: <asp:Label ID="lblInfoMobile_Credit" runat="server"  Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
                 </tr>
             </table>
         </asp:Panel>
        
     </td>
     </tr>
       
     <tr>
     <td>
         <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">
             <tr>
                 <td style="width:12%;height:30px;">
                 </td>
                 <td style="width:53%;">
                 </td>
                 <td style="width:35%;">
                     <asp:Label ID="lblFooterCompanyName" runat="server"  Font-Names="Calibri" Font-Size="12px" Font-Bold="true" ></asp:Label>
                 </td>
             </tr>
             <tr>
                 <td align="right" style="height:20px;font-family: Calibri;font-size: 10px;font-weight: bold;">Service Tax Regn #&nbsp;&nbsp;</td>
                 <td style="padding-left:3px;"><asp:Label ID="lblServiceTax" runat="server" Font-Names="Calibri" Font-Size="10px" Width="300px"></asp:Label></td>
                 <td></td>
             </tr>
             <tr>
                  <td align="right"  style="height:20px;font-family: Calibri;font-size: 10px;font-weight: bold;">PAN #&nbsp;&nbsp;</td>
                 <td style="padding-left:3px;"><asp:Label ID="lblPan" runat="server" Font-Names="Calibri" Font-Size="10px"></asp:Label></td>
                 <td valign="bottom" style="font-family:Calibri;font-size:12px;font-weight:bold;"><asp:Label Font-Names="Calibri" Font-Bold="true" Font-Size="12px" id="lblAuthorizedSignature"  runat="server" Text="†  Authorized Signatory" /> </td>
             </tr>           
            
         </table>
     </td>
     </tr>
     <tr>
     <td style="padding-bottom:10px;"><asp:Label Font-Names="Calibri" Font-Bold="true" Font-Size="12px" id="lblComputerGeneratedText"  runat="server" Text="† This is Computer Generated Invoice &amp; does not requires
         any Signature." />   </td>
     </tr>    
     <tr>
     <td>
      <asp:Panel ID="panelFooter" runat="server">
     <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">    
     <tr>
     <td style="border-top:dotted 2px #000000;"></td>
     </tr>   
     <tr>
     <td style="background-color:#d8d8d8;height:25px;" align="center" style="font-family: Calibri;font-weight: bold;font-size: 12px;">Kindly Remit this part along with your Cheque/DD payment</td>
     </tr>    
     <tr>
     <td>
     <table cellpadding="0" cellspacing="0" width="100%" class="InvoiceText">
             <tr>
                 <td style="width:10%;height:20px;" align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">
                 Shop #&nbsp;&nbsp;
                 </td>
                 <td style="width:40%;">
                     <asp:Label ID="lblReturnUnits" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label>
                 </td>
                 <td style="width:25%;">                    
                 </td>
                 <td style="width:25%;">                    
                 </td>
             </tr>
             <tr>
             <td style="height:20px;"  align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">Shop Name&nbsp;&nbsp;</td>
             <td><asp:Label ID="lblReturnBrandName" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label></td>
             <td></td>
             <td></td>
             </tr>
              <tr>
             <td style="height:20px;"  align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">Bank Name&nbsp;&nbsp;</td>
             <td></td>
             <td style="font-family: Calibri;font-weight: bold;font-size: 12px;">Cheque #</td>
             <td style="font-family: Calibri;font-weight: bold;font-size: 12px;">Dated</td>
             </tr>
             <tr>
             <td style="height:20px;"  align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">Amount&nbsp;&nbsp;</td>
             <td><asp:Label ID="lblReturnAmount" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label></td>
             <td></td>
             <td></td>
             </tr>
             <tr>
             <td style="height:20px;"  align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">
             <asp:Label ID="lblReturnInvoiceMonthLabel" runat="server" Text="Month"   Font-Names="Calibri" Font-Size="12px" Font-Bold="true"></asp:Label>
             </td>
             <td><asp:Label ID="lblReturnInvoiceMonth" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label></td>
             <td></td>
             <td></td>
             </tr>
             <tr>
             <td style="height:20px;"  align="left" style="font-family: Calibri;font-weight: bold;font-size: 12px;">Invoice #&nbsp;&nbsp;</td>
             <td><asp:Label ID="lblReturnInvoiceDisplayId" runat="server" Font-Names="Calibri" Font-Size="12px"></asp:Label></td>
             <td></td>
             <td></td>
             </tr>
     </table>
     </td>
     </tr>
      <tr>
     <td style="background-color:#808080;">&nbsp;</td>
     </tr>
     </table>
     </asp:Panel>
     </td>
     </tr>
    
     </table>
      </td>
      </tr>
      </table>
    </div>
    </form>
</body>
</html>

**************Code behind has some coding for populating the grid best on the parameters i pass with the invoice url...*******

Please help me to achieve this........



Answers (1)