Following bug-report related to mPDF (http://www.mpdf1.com/mpdf/) v5.5 –
...doesn’t works properly. – It doesn’t apply CSS-style to
inside
element appears inside the list (inside), all the paragraphs will be broken. For some reason mPDF adds an additional line break after each paragraph and after each table. Also, for some reason, even table which used in PDF footer (as HTML footer) will have additional line break, destroying page margins. – It adds odd top padding to each
in normal content (outside of
((.|\s)*?)<\/pre>/i', '$1', $html); } $html_for_mpdf = pre_to_div($html_for_mpdf); .ex_pre class described as div.ex_pre, pre { padding:4px; width:99%; overflow:auto; background:#EFEFEF; border:1px dotted #CCC; } – Oh shit! Even after the workaround above, it appears that mPDF doesn’t applies the CSS-styles for’s insde the lists... Andis no more blocking HTML-element:( But at least it doesn’t breaks styles after the list... Well, another workaround: we can add
after eachinside the list. Plus we can convert \n-style linebreaks to
’s inside the pre (which become’s) now: function unescape_quotes($s) { return str_replace('\"', '"', $s); } function _mpdf_list_workaround_li($html) { return preg_replace('/]*?)>((.|\s)*?)<\/div>/ie', "''.nl2br(unescape_quotes('$2')).'
'", $html); } function mpdf_list_workarounds($html) { return /* add
after eachinside- 's This code sucks, since it will also unable to process blocks after nested lists, like
*/ preg_replace('/
- ]*?)>((.|\s)*?)<\/li>/ie', "'
- '._mpdf_list_workaround_li(unescape_quotes('$2')).'
'", // replace allwith's preg_replace('/((.|\s)*?)<\/pre>/i', '$1', $html)); } – Damn... one more bug with CSS-processing... You probably noticed red outlined div above in example of CSS, which describes «.ex_pre» class. It’s because mPDF don’t understand styles described as «tag.class». So, unfortunately we have to declare.ex_pre class for ALL tags, not exclusively div’s:( – And yet more bugs with lists... mPDF displays all the text after «inner»as next list item. For example,
(The workaround above which replaces
- First level item 1
This text will be displayed as separate list item #2, and text in real 2nd item will be displayed as 3rd list item.
- Subitem 1
- Subitem 2
- First level item 2
's with's also contains this buglike feature) ———————————— This document has been copied from FAVOR.com.ua (https://favor.com.ua/en/blogs/9836.html). All rights reserved by author of the material. In case of re-publication, the link to the source of the material is strongly required! Document date: August 5, 2012