mpdf:没有获得一致的表单外观

mpdf: not getting a consistent form look

我通过mpdf创建了一个表单,但是各个字段的字体不一致。有些看起来比其他的大。以下是代码:

<head>
<style>
    .atable tr th{
        background-color: #FF0000;
        
    }
    .atable tr td{
        background-color: #FF0000;
        
    }
    td{
        border:none;
    }
    </style>
</head>
<?php
include("\mpdf\mpdf.php");
$mpdf=new mPDF('','A4');
//$mpdf->simpleTables = true;
//$mpdf->packTableData = true;
$keep_table_proportions = TRUE;
//$mpdf->shrink_tables_to_fit=1;

$a='<style>@page {
 margin: 5pt;
}</style>';


$a.='<table style="width:100%;font-size:8.5pt;autosize="1">
    <tr>
        <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">CBSE Reg. No.</td>
        <td style="width:20%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">Sr. No.</td>
        <td style="width:20%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">School Addmission No.</td>
        <td style="width:20%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
    </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name of Pupil&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Father Name&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mother Name&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nationality&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Whether the candidate belongs to Schedule Caste or Schdule Tribe&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date of first addimision in the School with class&nbsp&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date of birth(in Christian Era) according to admission Register(in figures)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(in words)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class in which the pupil last studied (in figure)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(in words)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;School/Board Annual Examination last taken with result&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Whether failed, if so once/twice in the same class&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subject Studied&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Whether qualified for promotion to the higher class;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(in words)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Month upto which the (pupil has paid)school dues/paid&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Any fee concession availed of: if so, state the nature of such concession&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total No. of working days&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total No. of working days present&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Whether NCC Cadet/Boy Scout/Girl Guide(details may be given)&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Games played or extra-curricular activities in which the pupil usually took part(mention achivement level&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;General Conduct&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date of application for certificate&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date of issue of certificate&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reasons for leaving the school&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt">
        <tr>
            <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Any other remarks&nbsp;&nbsp;</td>
            <td style="width:99%;text-align:center;">-<hr color="black" SIZE="4pt"></td>
        </tr>
    </table>
    <table style="width:100%;font-size:8.5pt" >
    <tr>
        <td colspan="4" style="height:30pt">
        </td>
    </tr>
    <tr>
        <td style="width:25%;text-align:center;">Signature of Class Teacher</td>
        <td style="width:25%;text-align:center;">Prepared By</td>
        <td style="width:25%;text-align:center;">Checked By<br>(state full name<br>and designation)</td>
        <td style="width:25%;text-align:center;">Principal<br>SEAL</td>
    </tr>
    </table>';
     //echo $a;
    //exit;
    
$mysqli->close();

$mpdf->AddPage();
$mpdf->WriteHTML($a);
$mpdf->Output('mytable.pdf', 'D');
exit;
?>

以下是我得到的表格

请告诉我如何为每个文本元素获得相同的 ont 大小,即使我需要在顶部放置一个 header 图片也需要 space.

尝试在所有部分进行以下更新:

<table style="width:100%;font-size:10pt">
    <tr>
        <td style="border-bottom:2px solid white;white-space: nowrap;width: 1px;">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Father Name&nbsp;&nbsp;</td>
        <td style="auto;text-align:center;"><center>-</center><hr style="padding:0px;margin:0px;" color="black" SIZE="4pt"></td>
    </tr>
</table>