Я не могу управлять шириной таблицы td, пока я генерирую pdf в php, используя dompdf. все хорошо, пока печатаем в html, но ширина td увеличивается при генерации pdf. В моем CSS я установил ширину и размер моей страницы. Затем я попытался управлять шириной моего стола. Даже я написал индивидуально CSS для управления шириной TD и, наконец, это не сработало.
Мне нужна эта таблица ниже, каждый тд которой будет 10 пикселей или максимум 15 пикселей;
<?php
require('../config.php');
require('../functions.php');
$con = connect(USE_PCONNECT,DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE);
ob_start();
$exam_shedule_id = $_GET['itemid'];
$chkexam = getResultArr("SELECT * , (SELECT title FROM subjects WHERE subjects.sub_code = th_exam.sub_code
AND FIND_IN_SET(th_exam.course_code , subjects.courses_code) <> 0) as subject
FROM th_exam WHERE exam_shedule_id = '$exam_shedule_id' ORDER BY th_exam.sub_code ASC");
$exam_shedule = getARecord("SELECT *,(SELECT title FROM departments WHERE id = dept) as dpt, (SELECT fullname FROM users WHERE user_id = verified_by) as fullname FROM exam_shedule WHERE id = '$exam_shedule_id'");
/// check tabulator
//$examshid = $chkexam['exam_shedule_id'];
$tabulatorArr = getResultArr("SELECT e.sub_code, t.stu_id ,t.avg, t.ca, t.total_marks, t.gp, t.lg FROM th_tabulator_1 as t, th_exam as e WHERE e.id= t.exam_id AND e.exam_shedule_id = '$exam_shedule_id' ORDER BY stu_id ASC");
$quee = array();
foreach($tabulatorArr as $key=>$value){
$quee[$value['stu_id']][$value['sub_code']] = $value;
}
$title= 'Tabulation Sheet';
$style ='<style>
@page {
margin: 0;
}
* { padding: 0; margin: 0; }
@font-face {
font-family: "source_sans_proregular";
src: local("Source Sans Pro"), url("fonts/sourcesans/sourcesanspro-regular-webfont.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "source_sans_probold";
src: local("Source Sans Pro Bold"), url("fonts/sourcesans/sourcesanspro-bold-webfont.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
body{
font-family: "source_sans_proregular", Calibri,Candara,Segoe,Segoe UI,Optima,Arial,sans-serif;
color: #333;
background-color: #fff;
height:100%;
}
body b, table th{
font-weight: normal;
font-family: "source_sans_probold", Calibri,Candara,Segoe,Segoe UI,Optima,Arial,sans-serif;
border: 1px solid black;
}
table td, table th{
width: 100%;
vertical-align: top;
align:center;
}
</style>
';
$col=0; $tcol = (sizeof($chkexam) * 5 ) +12;
//$html ='<div align="center">';
$headhtml = '<table class="list-tbl" cellpadding="5" cellspacing="0" border="0" width="100%" >
<thead>
<tr class="border-line">
<th rowspan="3" class="rotate"><div><span><strong>Serial No.</strong><br><br><br><br></span></div></th>
<th rowspan="2" > Course Title </th> ';
foreach($chkexam as $key=>$value){
$headhtml .= '<th colspan="5">'.$value['subject'].'
</th>';
$tabulator2 = $value['tabulator2'];
$tabulator1 = $value['tabulator1'];
}
$headhtml .= '<th colspan="4" >Result of Current Trimester</th> <th colspan="6" >Cumulative Result up to this Trimester</th>
</tr><tr class="border-line">';
foreach($chkexam as $key=>$value){
$headhtml .= '<th colspan="5">'.$value['sub_code'].' CP: '.$value['cp'].'</th>';
}
$headhtml .= ' <th rowspan="2" class="rotate"><div><span>Total Grade Point<br>(TGP)<br><br><br><br></span></div></th>
<th rowspan="2" class="rotate"><div><span>Total Grade Point Ave.<br>(GPA)<br><br><br><br></span></div></th>
<th rowspan="2" class="rotate"><div><span>Total Credit Point<br>(TCP)<br><br><br><br></span></div></th>
<th rowspan="2" class="rotate"><div><span>Earned Creadit Point<br>(ECP)<br><br><br><br></span></div></th>
<th rowspan="2" class="rotate"><div><span>Sum of Previous <br>Trimester TGP <br><br><br><br></span> </div> </th>
<th rowspan="2" class="rotate"><div><span>Total Grade Point<br>(TGP) </span> <br><br><br><br></div> </th>
<th rowspan="2" class="rotate"><div><span>Total Credit Point<br>TCP) </span> <br><br><br><br></div> </th>
<th rowspan="2" class="rotate"><div><span>Credits Earned <br><br><br><br></span> </div></th>
<th rowspan="2" class="rotate"><div><span>CGPA </span> <br><br><br><br></div></th>
<th rowspan="2" class="rotate"><div><span>Comments <br><br><br><br></span></div></th>
</tr>';
$headhtml .= '<tr class="border-line">
<th class="rotate"><div><span><strong>Student ID</strong></span></div></th>';
foreach($chkexam as $key=>$value){
$headhtml .= '<th class="rotate"><div><span> Continuous Assessment <br>Full Marks : 50 <br><br><br><br></span></div></th>
<th class="rotate"><div><span> Trimester Final <br>Full Marks : 50 <br><br><br><br></span></div></th>
<th class="rotate"><div><span> Total Full Mark : 50 <br><br><br><br></span></div></th>
<th class="rotate"><div><span> Grade Point(GP) <br><br><br><br></span></div></th>
<th class="rotate"><div><span> Letter Grade(LG) <br><br><br><br></span></div></th>';
}
$headhtml .= ' </tr>
</thead>
<tbody>';
$footerhtml = ' </tbody>
<tfoot>
<tr>
<td width="300" colspan="5" valign="top" align="left"><br><br><br> .......................................................<br>Tabulator 1: '.$authArr1['fullname'].'
</td>
<td width="300" colspan="5" valign="top" align="left"><br><br><br> .......................................................<br>Tabulator 2: '.$authArr2['fullname'].'
</td>
<td width="300" colspan="5" valign="top" align="left"><br><br><br> .......................................................<br>Chief Tabulator
</td>
<td width="300" colspan="5" valign="top" align="left"><br><br><br> .......................................................<br>Verified By <br>'.$exam_shedule['fullname'].'
</td>
<td width="250" colspan="5" valign="top" ><br><br><br> .......................................................<br>Deputy Controller of Examinations
</td>
<td width="300" colspan="5" valign="top" align="right"><br><br><br> ...............................................<br>Controller of Examinations
</td>
</tr>
</tfoot>
</table>
</page>';
/* $result=getResultArr("SELECT *,(SELECT name FROM students WHERE students.roll_no = exam_apply_roll.roll_no AND students.batch_id = '$exam_shedule[batch]') AS name FROM exam_apply_roll
WHERE exam_shedule_id='$exam_shedule_id' ORDER BY id ASC") ;*/
$pagelimit = 19; $row = 1;
$html .= $headhtml;
$page = 1;
$result = getResultArr("SELECT * FROM th_tabulation_sheet WHERE exam_shedule_id = '$exam_shedule_id' ORDER BY stu_id ASC");
$totalrow = sizeof($result);
if($result)
foreach($result as $key=>$value){
$tgp = 0; $totalcp = 0; $data = array();
$html .= '<tr >
<td>'.($key+1).'</td>
<td>'. $value['stu_id'] .'</td>';
foreach($chkexam as $key2=>$value2){
$html .= '<td>'. $quee[$value['stu_id']][$value2['sub_code']]['ca'].' </td>
<td>'. $quee[$value['stu_id']][$value2['sub_code']]['avg'].'</td>
<td>'. $quee[$value['stu_id']][$value2['sub_code']]['total_marks'].'</td>
<td>'. $quee[$value['stu_id']][$value2['sub_code']]['gp'].'</td>
<td>'. $quee[$value['stu_id']][$value2['sub_code']]['lg'] .'</td> ';
}
// $tgpresult = $tgp * 3 ; $qty = sizeof($quee[$value['roll_no']]);
//$gparesult = $tgp / $qty ;
// $tcp = $tgpresult / $gparesult;
$html .= '<td>'. $value['tgp'] .'</td>
<td>'. $value['gpa'] .'</td>
<td>'. $value['tcp'] .'</td>
<td>'. $value['ecp'].'</td>
<td>'.$value['sum_tgp'].'</td>
<td>'.$value['ttgp'].'</td>
<td>'.$value['ttcp'].'</td>
<td>'.$value['ce'].'</td>
<td>'.$value['cgpa'].'</td>
<td> </td>
</tr>';
$row++;
if($pagelimit == $row){
$html .= $footerhtml;
if($totalrow>($key+1)) { $html .= $headhtml; $page++; }
// $html .= $headhtml;
$row= 0 ;
}
}
// echo $totalrow .'!='. $pagelimit * $page;
$exppage = ($pagelimit * $page)-1;
if($totalrow != $exppage || $totalrow < $pagelimit) $html .= $footerhtml;
$file = $style.$html;
echo $file;
disconnect();
ini_set('display_errors', 1);
require './../vendor/autoload.php';
use Dompdf\Dompdf;
$html = ob_get_clean();
$dompdf = new Dompdf();
$dompdf->loadHtml($html, 'UTF-8');
//$dompdf->setPaper('sra1', 'landscape');
//$customPaper = array(0,0,1600,6600);
//$dompdf->set_paper($customPaper);
$dompdf->set_paper(array(0, 0, 2551.18, 3628.35), 'landscape');
// $dompdf->setPaper([0, 0, 685.98, 396.85], 'landscape');
$dompdf->loadHtml($file);
$dompdf->render();
$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));
exit(0);
?>
Пожалуйста, помогите мне ..