Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility #78

Open
iamanissa opened this issue Feb 16, 2017 · 5 comments
Open

Accessibility #78

iamanissa opened this issue Feb 16, 2017 · 5 comments

Comments

@iamanissa
Copy link

In adobe acrobat you can see certain 508 compliant accessibility information under File>Properties>Description. You allow for Title, Author and a few other things, but not tags. Under Description Tagged PDF = NO. It would be nice to add language tags like<span lang="es"> or headers that can be identified by readers like<th scope="col">Name</th> . Right now if I add the aforementioned tags, the entire tag shows up in the table, instead of being interpreted like the <b> tag.

@gettalong
Copy link
Member

Tagged PDF is a bit more complicated than you think. In addition to marking parts of a content stream with identifiers, a separate tree of PDF objects needs to be created to impart the correct meaning to these identifiers (i.e. is the identifier marking up a simple paragraph or a heading?).

I don't think that Prawn can handle this currently.

@iamanissa
Copy link
Author

Oye, well that makes sense. Thank you for responding so fast. Hopefully one day it can happen. I'm rooting for yall.

@JoeOsterfeld
Copy link

Are there any updates on this topic? We're looking for the ability to tag the PDF for screenreaders: h1, h3, and p elements, specifically. Thank you!

@jimmarq
Copy link

jimmarq commented Jan 22, 2021

My university started using the Ally accessibility plugin (https://ally.ac/) for our learning management systems. Documents created with Prawn receive failing accessibility scores primarily because the generated PDFs lack tags. I really like the visual quality of the generated PDFs with Prawn, but I may have to move to a different platform if my institution imposes accessibility rules for documents posted to our learning management system.

@gettalong
Copy link
Member

@jimmarq You can do it with Prawn but you will need to implement it yourself. Ie. before outputting a header you would need to insert the necessary tag into the content stream and after the header the corresponding end tag. Additionally, you would need to create the correct PDF object for each such annotated part of the content stream. It is doable but much work.

Since generating tagged PDF involves much work most open source libraries don't implement it. Personally, I don't know of any that does it. See eg project-callisto/callisto-core#46 (comment)

If you wanna do it, here is an example that uses Apache PDFBox (Java): https://stackoverflow.com/a/49466066/8203541

ps. For a real end-to-end solution the PDF library would need to represent all the available structural elements so that one can say pdf.paragraph(...) instead of pdf.text(...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants