yii pdfable数据在底部被截断

时间:2013-06-07 16:01:27

标签: php pdf yii pdf-generation

我在Yii中使用pdfable创建了一个pdf。我已设法创建pdf文档,但是如果我为每页的顶部和底部设置边距,则每页都会有数据被截断。在我的控制器中

$pdf = $this->createPdf();
        $pdf->setOptions(array('orientation'=>'Landscape',
                'margin-top'    => 5,
                'margin-right'  => 10,
                'margin-bottom' => 5,
                'margin-left'   => 10,
                )
            );
        $this->layout = 'pdf';
        $pdf->renderPage('pdf',array('results'=>$asaareaList));

        $pdf->send('ProjectReport_'.date('M-Y').'.pdf');

在我看来

<head>
<style type='text/css'>

@media print{thead{display:table-header-group; margin-bottom:2px;}}
@page{margin-top:1cm;margin-left:1cm;margin-right:1cm;margin-bottom:1.5cm;}}

.odd {
    background: none repeat scroll 0 0 #E5F1F4;
}
.even {
    background: none repeat scroll 0 0 #F8F8F8;
}
table tbody tr:hover{
        background: none repeat scroll 0 0 lightgreen;
}
table tbody tr{
    font-size:10pt;
}
body
{
  margin: 0mm 0mm 0mm 0mm;

}

.grey{
    background: lightgrey;
}

.center{
    margin: 0 auto;
    text-align: center;
}

.size{
    font-size:15px;
}

table{
    padding-botton:30px;
}
thead{
    font-size:11px;
     font-weight: normal;
}

</style>
</head>
<!-- <body onload="window.print();window.close();">-->
<body>
<h1 class="grey center">Project Report</h1>
<table>
<?php 
$count = 0;
$class= null;
foreach($results as $key=>$data) {
?>

<tr class="grey size">
    <th colspan=12><?=$key ?></th>
</tr>
<thead>
    <tr>
        <th>Start Date</th>
        <th>Name</th>
        <th>Code</th>
        <th>Actual End Date</th>
        <th>Office</th>
        <th>%</th>
        <th>% Planned</th>
        <th>KM</th>
        <th>KM Planned</th>
        <th>Country</th>
        <th width="150">AREA</th>
        <th>PROJ INFO</th>
    </tr>
</thead>
<tbody>
<?php foreach($data as $column=>$q) {   ?>

    <?php 
        $class = ($count % 2 === 0) ? 'odd' : 'even';
        $this->renderPartial('_report',array('data'=>$q,'class'=>$class));
        $count++;
    }
    ?>
</tbody>


<?php }
?>
</table>
</body>

pdf结果,您可以在底部附近的图片中看到数据被切断。 enter image description here

第二张图片标题的css没有一路走到acroos不确定为什么? enter image description here

0 个答案:

没有答案