2011-11-14 119 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;只能用于顶层元素。