Inspecting accessibility
editPdfAccessibilityInspector reports the accessibility issues of a document that can be found automatically, from the requirements of PDF/UA and Tagged PDF. It reads the document and does not change it:
var report = PdfAccessibilityInspector.Inspect(PdfDocument.Open(file));
foreach (var issue in report.Issues)
{
Assert.Fail(issue.ToString()); // such as "MissingAlternateText (page 1): A Figure has no alternate text (/Alt)"
}| PdfAccessibilityIssueKind | Issue |
|---|---|
| MissingStructureTree | The document is not tagged: it has no structure tree |
| NotMarkedAsTagged | The catalog does not declare the document as tagged (/MarkInfo) |
| MissingLanguage, MissingTitle | The document has no natural language, or no title |
| TitleNotDisplayed | The viewer shows the file name instead of the title |
| UntaggedContent | Content of a page is neither tagged nor an artifact |
| MissingAlternateText | A figure or a formula has no alternate text |
| UntaggedAnnotation, MissingTabOrder | An annotation is not in the structure tree; a page with annotations does not order them by the structure |
| ReadingOrder | The structure reads the content of a page in another order than the content draws it |
| UnknownStructureType | A structure type is neither standard nor mapped to a standard type by the role map |
| SkippedHeadingLevel | A heading level is skipped, such as an H3 after an H1 |
- Each PdfAccessibilityIssue has its page, or none for the issues of the document, and the structure type it concerns.
- The content of an untagged document is not checked page by page: the whole document is untagged.
- The reading order is a heuristic: a document may draw its content in another order than it should be read on purpose. Review the pages it reports.
- The inspector checks what can be checked automatically: it does not judge whether an alternate text describes its figure. A document that must conform to PDF/UA should be validated with veraPDF too. To write tagged documents, see Tagged PDF and PDF/UA.