我想使用 DOMPDF 創(chuàng)建報(bào)表。我的pdf已成功創(chuàng)建,但問(wèn)題是我想以橫向方式打印出來(lái)。我給出了選項(xiàng),但它仍然顯示縱向視圖。如何解決此問(wèn)題?$pdf->setPaper('A4', 'landscape');//set page size and orientation<?phpif(isset($_GET["action"])){ include('database_connection.php'); require_once 'pdf.php'; session_start(); if($_GET["action"] == "leave_apply_report") { if(isset($_GET["month"],$_GET["department"])) { $pdf = new Pdf(); $currentMonth= date('Y-m'); $passmonth= $_GET["month"]; if($currentMonth == $passmonth){ $strat = date('Y-m-01'); $end = date('Y-m-d'); } else{ $strat = date('Y-m-01', strtotime($passmonth)); $end = date('Y-m-t', strtotime($passmonth)); } $query01 ="SELECT * FROM department WHERE dept_Id ='".$_GET["department"]."'"; $statement = $connect->prepare($query01); if($statement->execute()) { $result = $statement->fetchAll(); foreach($result as $row){ $header = '<table width="100%" border= 0>'; $header.='<tr><td style="width:50%"><b>Deprtment :</b><font size="1"><span> '. $row["dept_Name"] .'</span></font></td> <td style="width:17%"><b>Period :</b><font size="1"><span><span> '.$strat.' - '.$end.'</span><span></font></td></tr>' ; $header .= '</table>'; } } $query ="SELECT DISTINCT(emp_id),emp_name,Designation,Department,Section,shift_Id FROM nonacadamic INNER JOIN department ON department.dept_Name = nonacadamic.Department WHERE dept_Id = '".$_GET["department"]."'"; $statement = $connect->prepare($query); if($statement->execute()) { $result = $statement->fetchAll(); $headerfix = '<div class="body">這個(gè)我已經(jīng)嘗試過(guò)代碼.這個(gè)工作發(fā)現(xiàn),但唯一的問(wèn)題是在縱向中創(chuàng)建報(bào)告。
dompdf 橫向視圖在創(chuàng)建 PDF 時(shí)未應(yīng)用
人到中年有點(diǎn)甜
2022-08-05 09:34:25