php 带有 css 浮动的 DOMPDF
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16138140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DOMPDF with css float
提问by Joshua Blevins
I am not sure why but the html page displays just fine but the dompdf does not utilize the floats.
我不知道为什么,但 html 页面显示得很好,但 dompdf 不使用浮点数。
Code is 2300 + line long so to long to post here.... But it is all inline css.
代码是 2300 + 行长,所以在这里发布太长了......但它都是内联 css。
<div style="float:left;"> </div>
I have tried both wrapping the css in a style tag and inline with no luck.
我试过将 css 包装在样式标签中,但没有成功。
This is the html page
这是html页面
http://www.ems-complete.com/ccems/ccems_reports/daily_vehicle_check_sheet.php?id=5
http://www.ems-complete.com/ccems/ccems_reports/daily_vehicle_check_sheet.php?id=5
This is the dompdf link
这是dompdf链接
http://www.ems-complete.com/ccems/ccems_reports/form_daily_vehicle_check.php?id=5
http://www.ems-complete.com/ccems/ccems_reports/form_daily_vehicle_check.php?id=5
I am not sure why but the html page displays just fine but the dompdf does not utilize the floats...
我不知道为什么,但 html 页面显示得很好,但 dompdf 不使用浮点数...
Code is 2300 + line long so to long to post here.... But it is all inline css...
代码是 2300 + 行,所以在这里发布太长了......但它都是内联 css......
回答by BrianS
Float support is introduced in the 0.6.0 code base, but it is disabled by default since it is still in development. Make sure you have enabled it by setting DOMPDF_ENABLE_CSS_FLOAT to true.
Float 支持在 0.6.0 代码库中引入,但默认情况下是禁用的,因为它仍在开发中。通过将 DOMPDF_ENABLE_CSS_FLOAT 设置为 true 来确保您已启用它。
Starting with version 0.7.0 float support is enabled by default.
从 0.7.0 版开始,默认启用浮动支持。
That being said, since the feature is still in development you're not going to get the results you want. Floats that span more than one page don't currently work as expected because a page break occurs before the non-floated content is rendered.
话虽如此,由于该功能仍在开发中,因此您不会获得想要的结果。跨越多个页面的浮动当前无法按预期工作,因为在呈现非浮动内容之前发生了分页符。
回答by Geordy James
Guys use display: inline-block;instead of float. I use the older version of dompdf in my project. I enable DOMPDF_ENABLE_CSS_FLOAT true in dompdf_config.custom.inc file. But the float result is overlapping and distorted.The inline-block is the new and better way than using float left every time. Visit the following w3school link to more info. CSS Layout - inline-block
伙计们使用display: inline-block; 而不是浮动。我在我的项目中使用旧版本的 dompdf。我在 dompdf_config.custom.inc 文件中启用 DOMPDF_ENABLE_CSS_FLOAT true 。但是浮动结果是重叠和扭曲的。 inline-block 是比每次都使用 float left 新的更好的方法。请访问以下 w3school 链接以获取更多信息。CSS 布局 - 内联块
回答by karthikeyan ganesan
use def("DOMPDF_ENABLE_CSS_FLOAT", true); in dompdf_config.inc.php
使用 def("DOMPDF_ENABLE_CSS_FLOAT", true); 在 dompdf_config.inc.php 中
it works for your css float
它适用于您的 css 浮动
回答by Carlos Herrera
you need use https://github.com/barryvdh/laravel-dompdfis the plugin dompdf
for Laravel 5.
你需要使用https://github.com/barryvdh/laravel-dompdf是插件dompdf
的Laravel 5。
and change the config in:
并更改配置:
vendor/barrryvdh/laravel-dompdf/config/dompdf.php
供应商/barrryvdh/laravel-dompdf/config/dompdf.php
def("DOMPDF_ENABLE_CSS_FLOAT", true);
回答by mad MAx
use <div style="position: absolute; left: 6px;"></div>
in my case
用<div style="position: absolute; left: 6px;"></div>
在我的情况
def("DOMPDF_ENABLE_CSS_FLOAT", true);
is Not Working
不管用