In Cpdf::addText() (lib/Cpdf.php), word spacing for Unicode fonts is implemented with
$place_text = str_replace("\x00\x20", "\x00\x20)\x00\x20" . (-round($space_scale * $wordSpaceAdjust)) . "\x00\x20(", $place_text);
which places \x00 bytes between TJ array elements, outside any string. pypdf rejects the file (PdfReadError: Invalid Elementary Object starting with b'\x00'), and upload parsers built on it report the PDF as unreadable; pdf.js, poppler and PyMuPDF tolerate it.
Writing the number as plain ASCII renders identically (pdftoppm output byte-identical on our two-page document) and opens in pypdf:
$place_text = str_replace("\x00\x20", "\x00\x20) " . (-round($space_scale * $wordSpaceAdjust)) . " (", $place_text);
Repro: any text-align: justify paragraph with an embedded TTF font (Unicode), dompdf 3.1.6, then python -c "from pypdf import PdfReader; [p.extract_text() for p in PdfReader('out.pdf').pages]".
In
Cpdf::addText()(lib/Cpdf.php), word spacing for Unicode fonts is implemented withwhich places
\x00bytes between TJ array elements, outside any string. pypdf rejects the file (PdfReadError: Invalid Elementary Object starting with b'\x00'), and upload parsers built on it report the PDF as unreadable; pdf.js, poppler and PyMuPDF tolerate it.Writing the number as plain ASCII renders identically (pdftoppm output byte-identical on our two-page document) and opens in pypdf:
Repro: any
text-align: justifyparagraph with an embedded TTF font (Unicode), dompdf 3.1.6, thenpython -c "from pypdf import PdfReader; [p.extract_text() for p in PdfReader('out.pdf').pages]".