-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
PDF accessibility check #1260
Comments
@insightfuls Can you look at it? |
Just for the record, I'm also seeing this. Code sample
Your environment
|
I've found 2 issues:
In the PDF Reference there is no mention of the Markings dictionary, it should be renamed to MarkInfo. |
Would it be possible to regenerate https://github.com/foliojs/pdfkit/blob/master/demo/accessible.pdf using the fixed accessibility code? |
Tagged PDF option is now fixed in master branch! Thank you! But there are still some failed checks...
Is there any way to fix it? Thank you! |
@adrift2000 Actually the PDF 1.7 reference mentions both, and it isn't clear which is correct. I can't remember now what led me to believe |
|
I searched for the word “Markings” in the PDF Reference 1.7 and no entries were found. |
Hi, @insightfuls sorry to bother but there are any updates on your solution? :( |
I'm looking forward for Tab order fix as well! That sounds as pretty easy, right? |
I am also looking forward to it! I also have two more questions/suggestions regarding accessibility of the PDFs:
Would it be possible to add these functionalities in the next release? Thanks in advance! |
That would be very important to create an accessible PDF. PAC3 always issues errors when creating tables because the scope = "col" cannot be passed. Accessible PDF is becoming more and more important and PDF Kit is a wonderful tool to create them automatically. Many Thanks :). |
Hi, @nippoolg for point number 2 could you explain it? Is it on code? I've struggled with the Tab Order issue on the accessibility checker from Adobe Acrobat. I couldn't find the documentation at pdfkit or am I missing something? Thanks in advance |
Sorry I've been a bit silent. I guess I've been a bit buried under email for a few months. Let me see what I can do about some of these improvements. Please stay tuned, and don't hesitate to message me in a couple of weeks to remind me if you don't hear anything! |
Thank you very much for the response, hopefully, the Tab Order issue has the chance to shine to be the next improvement and it will be really helpful. |
About point number 2, I think you are right @nippoolg. I have added the
and now the Tab order check pass in Adobe Acrobat Pro. If you want @insightfuls, I can create a PR |
PR never hurts @oscarbotteri . My main concern is...do we want to unconditionally do this? Perhaps only if structure has actually been created and/or PDF is tagged? |
nono, I did it just as an example.. because there was a user asking where to apply this change. Based on this:
I agree with you @insightfuls this should be set to Also I think we can add this as an optional
I am not sure what are valid values for this new key. let me take a look and I will create a PR |
Liking the sound of it @oscarbotteri . |
I added a PR in #1449 per @oscarbotteri's solution because we need this functionality for PDFs to pass accessibility review. |
It's because for
This is another structure element property. Perhaps another candidate for special treatment.
I'll see what I can do. |
Thanks a lot, @acrollet . I've reviewed it. If you have a bit of time to address the review comment, that'd be great, or let me know and I can have a go. I have some personal stuff that needs procrastination at the moment, so the email from GitHub about your PR was welcome. ;-) |
I've been there 😄 |
I would like to bump this up - As per 508 requirements, WCAG 2.1 AA compliance is required for PDFs. Both the browser demo and example on the site fail the acrobat accessibility checker: https://pdfkit.org/
Regarding the image issue described above, I have a suggestion:
Note: An artifact is explicitly distinguished from real content by enclosing it in a marked-content sequence with the /Artifact tag (or /Artifact propertyList) If possible, maybe alert the render is going to place everything as Artifact in the console?
|
I'm currently looking at implementing support for PDF/UA in our application and we make use of PDFKit. We are using PAC2021 to check for compliance. @rnewhook586 not sure how much it helps as I'm mainly doing my stuff in node, but in its current state, PDFKit can cover a lot of the PDF/UA requirements for us. For example, when building the var pdfOptions = {
autoFirstPage: false,
modifying: false,
copying: false,
annotating: false,
pdfVersion: '1.7',
subset: 'PDF/UA',
tagged: true,
displayTitle: true,
lang: 'en-GB'
}; The failing issue I have at the moment is a BBox on a // PDFStructureElement constructor
if (typeof options.bbox !== 'undefined') {
data.BBox = options.bbox;
} // PDFStructureElement _contentForClosure
const content = this.document.markStructureContent(this.dictionary.data.S, this.dictionary.data); // pass all the data, containing BBox
// const content = this.document.markStructureContent(this.dictionary.data.S); // MarkingsMixin markContent
...
const dictionary = {};
if (typeof options.mcid !== 'undefined') {
dictionary.MCID = options.mcid;
}
// changes start
if (tag === 'Figure') {
if (Array.isArray(options.BBox)) {
dictionary.BBox = [options.BBox[0], this.page.height - options.BBox[3], options.BBox[2], this.page.height - options.BBox[1]];
}
}
// changes end
if (tag === 'Artifact') {
... This does result in a BBox for the
However, PAC2021 still fails on Logical Structure: I add the image like so: // Initialise document logical structure
var struct = doc.struct('Document');
doc.addStructure(struct);
struct.add( doc.struct('Figure', { alt: 'OmnisLogo ', bbox: [28.369759, 28.369759, 555.273975, 174.377073] }, () => {
// picture object ident 1024
om.clipRectangle(doc, 28.369759, 28.369759, 555.273975, 174.377073)
doc.image('C:\\OmnisBuild\\11.0\\Debug\\output\\Omnis_x64\\omnispdf\\omnis_studio_13468_2_2.png', 473.124132, 40.366244, {width:88.491085, height:87.002863});
doc.restore();
})); I wonder if somebody has some ideas to point me in the right direction, perhaps @insightfuls when you have some time? |
Hi, here is an example of how it works for me: var imageSection = doc.struct('Document'); imageSection.add( imageSection.add( |
@Dress13 thank you very much! It turns out, all I needed to pass (PAC2021 at least) was the To be honest, I don't understand how it passes since the bounding box it complained about is still not there technically. But hey, it passes and we have both the tag & the logical structure, so I think screen readers will be happy! Thanks again! |
Question
Description
I'm checking PDF accessibility with Acrobat PRO, taking accessible.pdf from demo https://github.com/foliojs/pdfkit/blob/master/demo/accessible.pdf
The accessibility report tells that Tagged PDF check failed. If I open file properties Tagged PDF is NO. Looks like this setting is not set properly, when creating PDF with tagged: true option. Or what could be the issue?
Code sample
const doc = new PDFDocument({
pdfVersion: '1.5',
lang: 'en-US',
tagged: true,
displayTitle: true
});
Your environment
The text was updated successfully, but these errors were encountered: