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 Name of Pupil </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 Father Name </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 Mother Name </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 Nationality </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 Whether the candidate belongs to Schedule Caste or Schdule Tribe </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 Date of first addimision in the School with class  </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 Date of birth(in Christian Era) according to admission Register(in figures) </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 (in words) </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 Class in which the pupil last studied (in figure) </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 (in words) </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 School/Board Annual Examination last taken with result </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 Whether failed, if so once/twice in the same class </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 Subject Studied </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 Whether qualified for promotion to the higher class; </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 (in words) </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 Month upto which the (pupil has paid)school dues/paid </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 Any fee concession availed of: if so, state the nature of such concession </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 Total No. of working days </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 Total No. of working days present </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 Whether NCC Cadet/Boy Scout/Girl Guide(details may be given) </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 Games played or extra-curricular activities in which the pupil usually took part(mention achivement level </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 General Conduct </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 Date of application for certificate </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 Date of issue of certificate </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 Reasons for leaving the school </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 Any other remarks </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 Father Name </td>
<td style="auto;text-align:center;"><center>-</center><hr style="padding:0px;margin:0px;" color="black" SIZE="4pt"></td>
</tr>
</table>
我通过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 Name of Pupil </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 Father Name </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 Mother Name </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 Nationality </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 Whether the candidate belongs to Schedule Caste or Schdule Tribe </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 Date of first addimision in the School with class  </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 Date of birth(in Christian Era) according to admission Register(in figures) </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 (in words) </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 Class in which the pupil last studied (in figure) </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 (in words) </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 School/Board Annual Examination last taken with result </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 Whether failed, if so once/twice in the same class </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 Subject Studied </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 Whether qualified for promotion to the higher class; </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 (in words) </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 Month upto which the (pupil has paid)school dues/paid </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 Any fee concession availed of: if so, state the nature of such concession </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 Total No. of working days </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 Total No. of working days present </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 Whether NCC Cadet/Boy Scout/Girl Guide(details may be given) </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 Games played or extra-curricular activities in which the pupil usually took part(mention achivement level </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 General Conduct </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 Date of application for certificate </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 Date of issue of certificate </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 Reasons for leaving the school </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 Any other remarks </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 Father Name </td>
<td style="auto;text-align:center;"><center>-</center><hr style="padding:0px;margin:0px;" color="black" SIZE="4pt"></td>
</tr>
</table>