DOMPDF with css float

2019-04-19 09:11发布

I am not sure why but the html page displays just fine but the dompdf does not utilize the floats.

Code is 2300 + line long so to long to post here.... But it is all inline css.

<div style="float:left;"> </div>

I have tried both wrapping the css in a style tag and inline with no luck.

This is the html page

http://www.ems-complete.com/ccems/ccems_reports/daily_vehicle_check_sheet.php?id=5

This is the dompdf link

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...

Code is 2300 + line long so to long to post here.... But it is all inline css...

标签: php html dompdf
5条回答
放我归山
2楼-- · 2019-04-19 09:22

use <div style="position: absolute; left: 6px;"></div> in my case

def("DOMPDF_ENABLE_CSS_FLOAT", true);

is Not Working

查看更多
唯我独甜
3楼-- · 2019-04-19 09:31

use def("DOMPDF_ENABLE_CSS_FLOAT", true); in dompdf_config.inc.php

it works for your css float

查看更多
【Aperson】
4楼-- · 2019-04-19 09:31

you need use https://github.com/barryvdh/laravel-dompdf is the plugin dompdf for Laravel 5.

and change the config in:

vendor/barrryvdh/laravel-dompdf/config/dompdf.php

def("DOMPDF_ENABLE_CSS_FLOAT", true);
查看更多
不美不萌又怎样
5楼-- · 2019-04-19 09:38

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

查看更多
相关推荐>>
6楼-- · 2019-04-19 09:40

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.

Starting with version 0.7.0 float support is enabled by default.

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.

查看更多
登录 后发表回答