pypdf icon indicating copy to clipboard operation
pypdf copied to clipboard

ENH: Add alt text to images

Open domoritz opened this issue 1 year ago • 6 comments

I would like to programmatically add alternative texts for screen readers to images. Is that possible right now?

The way the feature could be used is to identify a node (using some kind of object id) and then adding an alt text with a method call on the node. Then one would write the new PDF document back to a file.

domoritz avatar Mar 10 '23 16:03 domoritz

I don't know if the pdf format supports it. Feel free to add this feature

MartinThoma avatar Mar 10 '23 23:03 MartinThoma

It's definitely supported but I don't know how exactly. Acrobat has a feature to add alt texts in the accessibility tools. It usually requires that a document is tagged.

Unfortunately I don't have the time to add this feature right now and I would need more guidance on how to add it.

domoritz avatar Mar 11 '23 03:03 domoritz

I did a quick search on internet and found this page: https://www.umaryland.edu/cpa/toolbox/website-manual/accessibility/instructions-for-pdfs/working-with-alternate-text-in-acrobat/

It looks like alternative text depends on tagging. To confirm that, can you share a PDF file with such alternative texts?

pubpub-zz avatar Mar 11 '23 08:03 pubpub-zz

https://dl.acm.org/doi/pdf/10.1145/3517428.3544796 has alt texts for the images. The document looks tagged to me.

domoritz avatar Mar 11 '23 19:03 domoritz

Hi, thanks for the great work! Is there any roadmap for supporting this feature?

lukszam avatar Dec 06 '23 12:12 lukszam

No, there is no general roadmap for the pypdf issues, but anyone interested in this is free to give it a try and open a corresponding PR.

stefan6419846 avatar Dec 07 '23 07:12 stefan6419846