使用EZPDF从PHP通过PHP导出时如何使表响应

时间:2015-11-06 12:51:19

标签: php mysql pdf export

我通过php从mysql显示ezpdf数据有问题。描述的内容很长,因此在导出时会通过纸张。有什么方法可以解决这个问题吗?

<?php session_start();
require 'config.php';
require 'class.ezpdf.php';
require 'cek/cek_session.php';

$sql  = mysqli_query($conn, "SELECT * FROM arsip WHERE unitkerja = '$sesen_uk' ORDER BY id_arsip ASC");
$i    = 1;
if (mysqli_num_rows($sql) > 0)
{
  while($tampil = mysqli_fetch_array($sql)) 
  {
    $data[$i] = array ( 'No'      => $i,
                    'Description'        => $tampil['desc'],
                    'Department'        => $tampil['dpt'],
                    'Location' => $tampil['location'],
                  );
            $i++;
  }  

  $pdf = new Cezpdf('A4','landscape');
  $pdf->ezSetCmMargins(1, 3, 3, 3);
  $pdf->ezText('Report', 17, array('justification' => 'center'));
  $pdf->ezSetDy(-10);

  $pdf->ezTable($data, '', '', '');
  $pdf->ezSetDy(-50);

  $pdf->ezStartPageNumbers(799,50, 10, 4);
  $pdf->ezStream();
}  
  else
  {
    echo '<script>alert("Belum ada data");location.replace("report.php")</script>';
 }
 ?>

输出应该是这样的:

http://tinypic.com/r/2zyl9xj/9

任何帮助都会很棒,谢谢。

1 个答案:

答案 0 :(得分:0)

您可以在以下选项中添加宽度:

setInterval(test, 100};
function test(){
    doWHATEVER…
}

宽度文本将被包装