Table overflow when creating PDF using dompdf

alt text

I am creating several PDF files with dompdf which contains text and images in a table. But if the text has a large URL, it wraps to the end of the line. All text and URLs are wrapped in a div with a fixed width and height, but the URL is still overflowing.

The same HTML displayed in the browser looks fine.

Any thoughts?

+5
source share
2 answers

, DOMPDF , . . - URL-, , . DOMPDF , .

dompdf v0.6.0 , , :

<span style="word-wrap: break-word;">http://example.com/really/long/.../url</span>

, (, a /). , . reflower , . :

preg_split('/([\s-]+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE)

, , , , . , URL-?, &, /, URL- :

$words = preg_split('/([\s-\?\&\/]+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE);

dompdf 0.6.1 RegEx dompdf/include/text_frame_reflower.cls.php 86 371. 0.7.0 RegEx dompdf/src/FrameReflower/Text.php 106 402.

RegEx , ( URL).

+3

dompdf/include/text_frame_reflower.cls.php , :

$words = preg_split('/([\s-]+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE);

, , , , . , URL-?, &, /, URL- :

$words = preg_split('/([\s-\?\&\/]+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE);

$words = array_flip(preg_split("/[\s-]+/u",$str, -1, PREG_SPLIT_DELIM_CAPTURE));

$words = array_flip(preg_split('/([\s-\?\&\/]+)/u', $str, -1, PREG_SPLIT_DELIM_CAPTURE));
+1

Source: https://habr.com/ru/post/1731501/


All Articles