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

<br> in <dd> causes PDF/UA validation warnings #874

Open jochenberger opened 2 years ago

jochenberger commented 2 years ago

If I have a multi-line <dd> content, I get "Possibly inappropriate use of a "Span" structure element" warnings in PAC2021.

grafik

The HTML is

<html lang="en-US">
  <head>
    <title>DD test</title>
  </head>
  <body>
    <dl>
      <dt>Foo</dt>
      <dd>Bar<br>Baz
      </dd>
    </dl>
  </body>
</html>

The resulting PDF is dd-test.pdf

jochenberger commented 2 years ago

Screen reader preview: grafik

Structure view grafik

jochenberger commented 2 years ago

I managed to work around the issue by adding:

dd br {
  display: block;
  line-height: 0;
}