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

Issues with Charts in PDF/UA documents #873

Open jochenberger opened 2 years ago

jochenberger commented 2 years ago

I'm trying to create a PDF/UA conformant document with a chart. When I run it through the PDF Accessibility Checker (https://pdfua.foundation/en/pdf-accessibility-checker-pac), I'm getting a validator error:

Error while parsing the PDF Document (Operator 'CS' not allowed in this current state.)

grafik

Unfortunately, that error message is not very helpful. Am I doing something wrong?

This is the generated PDF file. test.pdf

jochenberger commented 2 years ago

This is the HTML:

 <html lang="en">
  <head>
    <title>PDF/UA test</title>
    <meta name="subject" content="Experiment with charts in a PDF/UA document"/>
  </head>
  <body>
    <object type="jfreechart/pie" alt="A simple chart" title="Fruit Pie Chart 1" style="width:400px;height:400px;">
      <data name="Apple" value="23.2"/>
      <data name="Pear" value="43.2"/>
      <data name="Orange" value="53.2"/>
    </object>
  </body>
</html>
jochenberger commented 2 years ago

Probably related to #365

jochenberger commented 2 years ago

842 fixes this