2011-11-14 120 views
2

我想讓MPDF正確地使用溢出打印div:hidden。我已經閱讀了他們的文檔,並嘗試了各種各樣的東西。沒有運氣。每個mpdf,具有溢出的塊元素:隱藏必須具有position:absolute或position:fixed set。當你打印一個div時,這很好。當我嘗試嵌套div並需要內部剪輯文本時,問題就出現了。這就是我的意思是:MPDF和溢出的問題:嵌套div上隱藏

此打印出精美

$html = <<< EOM 
<div style='width:300px;height:100px;position:absolute;overflow:hidden;border:1px solid black;'> 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
</div> 
$html = <<< EOM 

這並不

$html = <<< EOM 
<div style='border:1px solid red;position:relative;'> 
<div style='width:300px;height:100px;position:absolute;overflow:hidden;border:1px solid black;'> 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
</div> 
</div> 
$html = <<< EOM 

PHP腳本是簡單

include("mpdf.php"); 
$mpdf=new mPDF(); 
$mpdf->WriteHTML($html); 
$mpdf->Output(); 

正如你所看到的唯一的區別是那一個div在另一個裏面。有沒有人想出瞭如何做到這一點?

回答

0

在mpdf中,您不能在嵌套div上使用overflow: hidden;overflow: hidden;只能用於頂層元素。