danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.93k stars 359 forks source link

html content contains multiple tags, and the text is displayed in the wrong order when dir="rtl" is specified #978

Open LuoHpeng opened 3 months ago

LuoHpeng commented 3 months ago
<html lang="zh-CN" dir="rtl">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rtl test</title>
  </head>
  <body style="direction: rtl;">
    <div class="content"><p id="diy001" class="paragraph y9-chapter" style="display:block"><span>diy001</span></p><p class="paragraph" ><span class=" ">one</span><strong class=" y9-bold " style="color: rgba(80, 227, 194, 1);">tow</strong><span class=" ">three</span></p><p class="paragraph"><span class=" ">a</span><span class=" " style="color: rgba(208, 1, 28, 1);"> b</span><span class=" ">c ,d</span></p></div>
  </body>
</html>

html displays the text order

image

Output pdf text content

image