HTML表格问题

时间:2014-12-11 13:44:27

标签: html pdf-generation

我正在使用从HTML2pdf.fr下载的HTML到PDF转换器,并在尝试呈现PDF时出现以下错误。

HTML代码无效,代码未按正确顺序关闭

我看不到HTML的问题。有人可以帮忙吗?

<html>
  <head>

  <style type="text/css">
  table{
    border-collapse: collapse;
    border: 1px solid black;
  }
  table td{
    border: 1px solid black;
    padding: 15px;
  }
  </style>

  <body>
  <p style='text-align: center; '>Car Loans</p>
  <table border='1' width='100%'>
  <tr>
  <td style='text-align:left; vertical-align: middle; '>Batch Number</td>
  <td style='text-align:left; vertical-align: middle; '>Dealer Name</td>
  </tr>
  <tr>
  <td style='text-align:left; vertical-align: middle; '><b>BN0000151</b></td>
  <td style='text-align:left; vertical-align: middle; '><b>Dealer</b></td>
  </tr>
  </table>
  <table width='100%' style='border-collapse: collapse; border-top: none;'>
  <tr>
  <td style='text-align:left; vertical-align: middle; border-top: none; '>Retail Price
  <br>
  <b>£11,450.00</b>
  </td>
  <td style='text-align:left; vertical-align: middle; border-top: none; '>Purchase Price
  <br>
  <b>£8,950.00</b>
  </td>
  <td style='text-align:left; vertical-align: middle; border-top: none; '>Funded Amount (75%)
  <br>
  <b>£6,712.00</b>
  </td>
  </tr>
  </table>
  <table width='100%' style='border-top: none; '>
  <tr>
  <td style='text-align:left; vertical-align: middle; border-top: none; '>Number of Cars
  <br>
  <b>3</b>
  </td>
  <td style='text-align:left; vertical-align: middle; border-top: none; '>Date Added
  <br>
  <b>25/11/2014</b>
  </td>
  </tr>
  <tr>
  <td style='text-align:left; vertical-align: middle; '>
  Invoice Received from Supplier Invoice Number
  <br>
  <b>Yes</b>
  </td>
  <td style='text-align:left; vertical-align: middle; '>
  Email Received from Dealer Requesting Payment to be Made?
  <br>
  <b>Yes</b>
  </td>
  </tr>
  <tr>
  <td style='text-align:left; vertical-align: middle; ' colspan='2'>
  Enter HPI Registrations for each car stock no same as reg no's
  <br>
  <br>
  <b>CL00461 - DS12 LYS</b>
  <br>
  <b>CL00462 - MK13 YOP</b>
  <br>
  <b>CL00463 - DS12 KLS</b>
  </td>
  <tr>
  <td style='text-align:left; vertical-align: middle; '>
  Date Money Sent&emsp;&emsp;/&emsp;&emsp;/
  <br>
  <br>
  Signature
  <br>
  <br>
  Amount <b>£6,712.50</b>
  </td>
  <td style='text-align:left; vertical-align: middle; '>
  Bank <b>Bank</b>
  <br>
  <br>
  Payee <b>Bloggs &amp; Smith</b>
  <br>
  <br>
  Account <b>12345678</b> Sort <b>010203</b>
  </td>
  </tr>
  <tr>
  <td style='text-align:left; vertical-align: middle; '>Authorised by <b>Amy Brown</b>
  <br>
  <br>
  Signature
  </td>
  <td style='text-align:left; vertical-align: middle; '>
  Entered on Intranet?
  <br>
  <br>
  By
  </td>
  </tr>
  <tr>
  <td style='text-align:left; vertical-align: middle; ' colspan='2'>
  Check List
  <br>
  <br>
  1) HPI paperwork attached for each car
  <br>
  <br>
  2) Invoices attached for each car
  <br>
  <br>
  3) Payment made from Big Bank
  </td>
  </tr>
  </table>

</body>

</html>

2 个答案:

答案 0 :(得分:1)

HTML2PDF希望仅使用验证的 HTML 4.01代码。 您可以使用W3C Markup Validation Service检查代码。 确保选择正确的文档类型4.01。

最佳, 迈克尔

答案 1 :(得分:0)

您的代码有一些错误,首先您必须添加一个doctype来告诉浏览器适用的规则。

然后您的<head>代码未关闭。

您最好缩进代码以快速找到未关闭的代码。