openhtmltopdf
openhtmltopdf copied to clipboard
PDF/UA and WCAG compliance issue with embedded files (attachments)
I need to create WCAG and PDF/UA compliant PDF from HTML. Therefore I have followed the instructions on https://github.com/danfickle/openhtmltopdf/wiki/PDF-Accessibility-(PDF-UA,-WCAG,-Section-508)-Support
It already works really well! Thanks for this awesome library!
I then added attachment files as described here: https://github.com/danfickle/openhtmltopdf/wiki/Embedding-downloadable-files
Unfortunately, this causes the following errors in the validation tool I am using (PAC 2021):
Issue 1
Sorry, german version of PAC. It basically reads "PDF document not readable (Operator 'CS' not allowed in this current state".
I have checked the PDF file in an editor, but did not find any occurrence of CS
.
Issue 2
This one reads: "Annotation not within a 'Annot' structure element"
30 0 obj
<<
/Type /Annot
/Subtype /FileAttachment
/FS 320 0 R
/AP 321 0 R
/AF [320 0 R]
/Rect [49.612503 603.1875 160.3125 619.05]
/F 4
/BS 322 0 R
/StructParent 15
>>
endobj
I guess /StructParents 0
in
9 0 obj
<<
/Type /Page
/MediaBox [0.0 0.0 595.275 841.875]
/Parent 2 0 R
/Contents 25 0 R
/Resources 26 0 R
/Annots [27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R 35 0 R 36 0 R
37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R]
/StructParents 0
/Tabs /S
>>
endobj
may cause the issue, but I don't know how to solve it.
The <a download=...
element is only nested in body > p
, without any further semantics. Maybe that's the issue.
<html>
...
<body>
...
<p>...</p>
<p>
<a ... href="attachments/Some_attachment.docx" ... download="" ...>Some attachment link</a>
</p>
...
Any ideas or hints? If you can help me understand the issue, I may be able to provide a patch, in case it is related to the library code rather than to my code.