如何使用收据打印机打印HTML文件

时间:2015-10-13 07:56:32

标签: c# html printing

我有一张销售发票作为HTML文件。我需要写程序在C#中使用Epson TM-T82II收据打印机打印该发票。我是程序新手..所以我需要知道最好的方法是什么,我该怎么做?

这里我附上了HTML文件和HTML代码的图片。 please click to see HTML Invoice screenshot

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body {
    font-family:Verdana, Geneva, sans-serif;
    font-size: 8pt;
    padding: 0 50pt 0 50pt;
}
table td, table th, table.sales th, table td.footer-text {
    font-size: 8pt;
}
h1 {
    font-family:Verdana, Geneva, sans-serif;
    padding-bottom:2px;
    margin-bottom:2px;
    color:chocolate;
    text-transform:uppercase;
    font-size: inherit;
    font-size: 1.5em;
}
h2 {
    font-family:Verdana, Geneva, sans-serif;
    padding-bottom:0px;
    margin-bottom:0px;
    color:chocolate;
    text-transform:uppercase;
    font-size: 1.3em;
}
h3 {
    font-family:Verdana, Geneva, sans-serif;
    padding-bottom:2px;
    margin-bottom:2px;
}
table.sales td {
    padding: 4px 10px 4px 10px;
}
table.sales th {
    padding: 5px 10px 5px 10px;
    background-color:#CCC;
}
tr.saleline td {
    border-bottom-color:chocolate;
    border-bottom-width: 1pt;
    border-bottom-style: solid;
    vertical-align: top;
}
.signature {
    display: none;
}
.horizontal-line {
    border: 0;
    height: 4pt;
    color:chocolate;
    background-color: chocolate;
}
.total {
    font-weight:bold;
    font-size:1.1em;
    background-color:#CCC;
}
.block1 {
    text-align:left;
    vertical-align:bottom
}
.block2 {
    text-align:right;
    vertical-align:bottom
}
.block3 {
    text-align:left;
    vertical-align:top;
}
.block4 {
    text-align:left;
    vertical-align:top;
}
.block5 {
    text-align:right;
    vertical-align:bottom;
}
.block6 {
    text-align:left;
    vertical-align:top;
    margin-top: 15px;
}
.block7 {
    text-align:left;
    vertical-align:top;
    margin-top: 15px;
}
.block8 {
    text-align:left;
    vertical-align:bottom;
}
.block9 {
    text-align:center;
    vertical-align:bottom;
}
.block10 {
    text-align:right;
    vertical-align:bottom;
}
.block11 {
    text-align:left;
    padding: 25px 0 15px 0;
}
.extracols {
    border-style:solid; 
    border-color:gray;
}
table.extracols {
    border-top-width: 1pt;
    border-right-width: 0;
    border-bottom-width: 1pt;
    border-left-width: 1pt;
    border-collapse:collapse;
    margin: 0 0 15pt 0;
}
table.extracols th {
    padding: 5px 10px 5px 10px;
    border-top-width: 0;
    border-right-width: 1pt;
    border-bottom-width: 0;
    border-left-width: 0;
    border-color:gray;
    border-style:solid; 
    background-color:#CCC;
}
table.extracols td {
    padding: 4px 10px 4px 10px;
    border-top-width: 0;
    border-right-width: 1pt;
    border-bottom-width: 0;
    border-left-width: 0;
    border-color:gray;
    border-style:solid;
    background-color:#FFF;
}
#footer {
    margin-top: 35px;
}
.footer-text {
    font-size: inherit;
    font-size: 0.97em   
}
</style>
</head>
<body  style="padding: 20 20 20 20">
<table width="100%">
  <tr>
    <td style="padding-bottom:20px"><table width="100%">
        <tr>
          <td style="text-align:left;"></td>
          <td class="block2" align="right"><h3>Y.P.Brothers</h3>
           No:55/B,<br/>Samagipura,<br/>Sewanagala.
<br/>077-6977139
<br/>mecduino@gmail.com
<br/>
           </td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><hr class="horizontal-line"/></td>
  </tr>
  <tr>
    <td><table width="100%"> 
        <tr>
          <td style="padding:10px 0 20px 0;"><table width="100%">
              <tr>
                <td width="33%" class="block3"><strong>Bill To</strong><br />
                ANUSHA SURIYA<br/>
                </td>
                <td class="block4"><strong></strong><br />

                </td>
                <td class="block5" align="right"><h1>invoice #1</h1>
                  <b>Date</b>: Oct 9, 2015
<br/><b>Due Date</b>: Oct 9, 2015
                 </td>
              </tr>
            </table></td>
        </tr>

        <tr>
            <td>

            </td>
          </tr>

        <tr>
          <td><table width="100%" class="sales">

              <!-- Headers -->
              <tr>
                 <th align="center">Qty</th>  <th align="center">Item</th>  <th align="right">Price</th>  <th align="right">Amount</th> 
              </tr>

              <!-- Rows -->
                <tr class="saleline">  <td align="left">12</td>   <td align="left">helaligth 35/=</td>   <td align="right">35.00</td>   <td align="right">420.00</td> </tr> 
  <tr class="saleline">  <td align="left">12</td>   <td align="left">200p CR SR 195/=</td>   <td align="right">195.00</td>   <td align="right">2,340.00</td> </tr> 
  <tr class="saleline">  <td align="left">36</td>   <td align="left">Sunlight 35g</td>   <td align="right">6.00</td>   <td align="right">216.00</td> </tr> 

              <!-- Totals -->
              <tr><td align="right" colspan="3">Subtotal</td><td align="right">2,976.00</td></tr><tr><td align="right" colspan="3"><b>TOTAL</b></td><td align="right"><b>2,976.00</b></td></tr><tr><td align="right" colspan="3">Less Payment</td><td align="right">2,760.00</td></tr><tr class="total"><td align="right" colspan="3"><strong>Balance Due</strong></td><td align="right">216.00</td></tr>

            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table width="100%" style="margin-top:30px">
        <tr>
          <td width="50%" class="block6"><h2></h2>

          </td>
          <td width="50%" class="block7" align="right"><h2></h2>

          </td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table class="block11" width="100%">
        <tr>
          <td><table></table></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>

  <div class="signature">
    <table border="0" cellspacing="2" cellpadding="2" align="left">
      <tr>
        <td style="padding-bottom:30px"></td>
      </tr>
      <tr>
        <td><b>Signed by:</b> 
<br/><b>Date:</b> 
<br/><b>Signature:</b><br/></td>
      </tr>
    </table>
  </div>

<div id="footer">
<table width="100%" border="0" cellpadding="2">
  <tr>
    <td align="center"><span class="footer-text">Thank you for your business.</span></td>
  </tr>
</table>
</div>
</body>
</html>

0 个答案:

没有答案