Fixing a PDF Accessibility Issue (Alternative description missing for an annotation) when converting an HTML Page to PDF

后端 未结 1 1550
执念已碎
执念已碎 2020-12-19 20:07

Currently, I am working on a program that converts an html page into a PDF using the iText Library.

The Checker that I am using is PAC3 -->PDF Accessibility Checker

相关标签:
1条回答
  • 2020-12-19 20:39

    You did not specify whether you using old code (XMLWorker, HTMLWorker) or new iText code (pdfHTML).

    This of course impacts the proposed solution.

    In my answer I am going to assume you are using pdfHTML

    There are several options:

    • edit the incoming HTML using a library like JSoup
    • convert the incoming HTML to iText IElement objects, and edit those, setting properties where needed
    • write your own custom TagWorker that handles all instances of a specific tag, and write custom logic to deal with the missing annotations.

    An example of a custom tag worker can be found here: https://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-custom-tagworker-example

    0 讨论(0)
提交回复
热议问题