我试图让 MPDF 正确打印带有溢出的 div:隐藏。我已经仔细阅读了他们的文档并尝试了各种方法。没有运气。根据 mpdf,带有“overflow:hidden”的块元素必须具有“position:absolute”或“position:fixed”集。当您只打印一个 div 时,这很好。当我尝试嵌套 div 并需要内部 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. …Run Code Online (Sandbox Code Playgroud)