htmlpdfitextscreen-readersxmlworker

iText -PDF reading issue on heading levels ( h1 - h6 )


Generated PDF by iText-XMLWorker 5.5.4. Everything is reading perfectly except heading levels (h1-h6) in screen reader.
Below code works fine on browsers but not in PDF.

<section>
 <h1>heading 1</h1>
 <h2>heading 2 </h2>
 <h3>heading 3 </h3>
 <h4>heading 4 </h4>
 </section>

Solution

  • Please take a look at the ParseHeaders example. It takes the headers.html page with headers from <h1> to <h2> and converts it to headers.pdf:

    enter image description here

    In your question, you claim that everything is working perfectly except heading levels (h1-h6), but you don't explain what isn't working. Please elaborate. As shown in the screen shot, the PDF looks OK, doesn't it? Can you explain what is wrong with the PDF? Can you show us your code?