2017-01-08 15 views
1

我的控制器是這樣的:如何調整簽名的位置以使其更具動態性(laravel dompdf)?

public function listdata(Request $request) 
{ 
    ... 
    $pdf = PDF::loadView('test_print.test', ['data' => $data]); 
    $pdf->setPaper('legal', 'landscape'); 
    return $pdf->stream('test_print.test'); 
} 

我的PDF圖是這樣的:

<h1>This is test</h1> 

<table class="tg"> 
    <tr> 
     <th class="tg-3wr7">kolom 1</th> 
     <th class="tg-3wr7">kolom 2</th> 
     <th class="tg-3wr7">kolom 3</th> 
     <th class="tg-3wr7">kolom 4</th> 
     <th class="tg-3wr7">kolom 5</th> 
    </tr> 
    @php ($row = 22) 
    @for($i=0;$i<$row;$i++) 
    <tr> 
     <td class="tg-rv4w">test 1</td> 
     <td class="tg-rv4w">test 1</td> 
     <td class="tg-rv4w">test 1</td> 
     <td class="tg-rv4w">test 1</td> 
     <td class="tg-rv4w">test 1</td> 
    </tr> 
    @endfor 
</table> 

<br> 
<!-- start position signature --> 
<div class="signature"> 
    London,&nbsp;8 January 2017<br> 
    Chelsea Player<br><br><br><br> 
    Eden Hazard<br> 
</div> 
<!-- end position signature --> 

結果是這樣的: enter image description here

它看起來分離到2的簽名的內容。有第1頁和第2頁

我想使結果看起來像這樣: enter image description here

我該怎麼做?

回答

0

DOMPDF docs

分頁符可以通過應用CSS屬性page-break-beforepage-break-after任何塊級元素插入。

所以插入具有定義屬性的類並使用此類。對於測試,你可以插入這樣的東西而不是<br>

<div style="page-break-before: always;"></div> 
+0

我的數據是動態的。如果我更改我的數據。 '$ row = 10'。它看起來像這樣:http://postimg.org/image/8x25gthqf/。應該定位第1頁上的簽名 –

+1

如果你的意思是你只希望它只出現在下一頁上,請嘗試使用'page-break-inside:';' – BrianS

+0

@BrianS,Great。有用。謝謝 –

相關問題