Open singleseeker opened 1 year ago
The sample you posted does not have any Dompdf-recognized word breaks (e.g., space characters). This is, unfortunately, the means by which Dompdf determines where to wrap the text. The library does not yet have the necessary logic for determining where to break lines in CJK text.
You can tell Dompdf to allow line breaks anywhere in the text using the following styling: overflow-wrap: anywhere;
. That'll be, mostly, OK, though obviously without any of the necessary logic one of the line breaking rules may be broken.
As for the missing text indentation, it looks like the lack of breakable text has revealed a bug in how Dompdf handles indents. It looks like Dompdf ignores the indent (or overrides it) when determining placement of a string of non-breakable text. This is true even if you've told Dompdf it can break the text anywhere.
You can see the indentation issue with Latin text as well:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
p {
text-indent: 2em;
}
</style>
</head>
<body>
<p>loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsum</p>
<p>lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum</p>
</body>
</html>
Wow, thank you for your prompt response. I hope this issue can be fixed in the future version.
Here's the HTML code to generate the PDF.
I'm hoping to achieve this desired result.
Unfortunately, what I ended up with is the following result. The last two paragraphs don't display the correct text indentation or spaces.