[BUG] Accessibility tags missing on download
vikraman-alea-bah opened this issue · comments
Description
Accessibility tags allow blind and low vision screen reader users the ability to access the information on PDFs. On download, the PDF needs to preserve the accessibility tags (and their order), the alternative text in images, and the title of the document. Without the tags a blind screen reader user cannot access the information in a human-readable way (if at all) on a digital PDF.
Bug:
A PDF with accessibility tags that is flattened and downloaded using unipdf loses some accessibility features such as accessibility tags and alternative text for images
.
Expected Behavior
Accessibility tags (in order) and alt text for images are preserved on download
How to test
You can test if a PDF has accessibility tags a few ways.
- Use the free tool PAC
- Use the adobe acrobat reader free version to see if PDF is tagged (image attached)
- Use adobe acrobat pro paid version and run accessibility checker (image attached)
Attachments
Attached you'll find:
- PDF with accessibility tags (accessibility-pdf.pdf)
- the output of the file on download with the tags removed (output.pdf)
- an image of where to find if the document is tagged with adobe acrobat free
- an image of what tags look like in adobe acrobat pro
adobe acrobat pro
adobe acrobat free
pdf with accessibility tags
pdf downloaded using unipdf (with lost accessibility tags)
Code
pdfReader, err :=pdf.NewPdfReader(bytes.NewReader(data))
if err != nil {
return nil, err
}
acroForm := pdfReader.AcroForm
if acroForm == nil {
return nil, errors.New("no form data present in pdf template")
}
w := &pdfFieldWriter{}
w.SetFields(acroForm.Fields)
w.LoadFieldOptions()
truPdf := pdfcore.PdfObjectBool(true)
acroForm.NeedAppearances = &truPdf
w.Write(FieldOptionTypes.ReservationNumber, issuance.ReservationNumber)
w.Write(FieldOptionTypes.Comment, issuance.Comment)
// this returns pdf with lost accessibility tags
return pdfReader.ToBytes(), nil
Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/
We have a license
Dear @vikraman-alea-bah
Thank you for providing such a detailed report on the issue. We have investigated it thoroughly and will get back to you with a response as soon as possible.
Thank you for your patience and understanding.
We have investigated this matter further and can confirm that UniPDF does not yet fully support accessibility features. However, we are committed to addressing this issue and have added it to our roadmap for future development. Our goal is to enhance the accessibility support for PDF documents.
Based on you attached document, we observed that some accessibility checks done in Adobe Acrobat are failing while others are passing. Nevertheless, we understand the importance of ensuring that every feature is properly implemented to generate documents with comprehensive accessibility support.
Thanks for looking into it @3ace! The most important thing is the preservation of the accessibility tags in order. Without that, we can't say the PDF is accessible.
Do you have a public facing roadmap that I can share with my team? PDF accessibility has become a requirement for us and it would be great if we could follow it on the roadmap to get an idea of when to expect it.
@vikraman-alea-bah Continuing from our last update, we've tried to investigate what needs to be improved on to support generating accessibility documents.
We've started by fixing the form flattening process to preserve all accessibility information.
Currently, we are in the process of creating an internal roadmap and do not have a public-facing version available.
However, I can assure you that PDF accessibility is a priority for us.