2017-02-03 3 views
1

J'ai créé un formulaire via mpdf mais les polices des différents champs ne sont pas cohérentes. Certains semblent plus grands que d'autres. Voici le code:mpdf: ne pas obtenir un aspect de forme cohérent

<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; 
?> 

Suite est la forme que je reçois enter image description here

S'il vous plaît dire comment puis-je obtenir la même taille en Ontario pour chaque élément de texte, même j'ai besoin de mettre en place une image d'en-tête sur le haut qui aura aussi besoin d'espace.

Répondre

1

essayer la mise à jour suivante dans toutes les sections:

<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> 
+1

yup, parfaitement fait. Thankx. – ITSagar