danfickle / danfickle/openhtmltopdf

PDF/UA and WCAG compliance issue with embedded files (attachments)

Open
#977 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

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
![image](https://github.com/user-attachments/assets/db1bdbf7-0b44-4660-b998-b6ae8af714a4)
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
![image](https://github.com/user-attachments/assets/7353b134-79f4-4409-acd3-7e89dc9243d2)
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 ` p`, without any further semantics. Maybe that's the issue.

```html

...

...

...



Some attachment link


...
```

----

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.