speedata Publisher and accessibility
Categories: Development
Version 4.19.8 has a completely written module for creating tagged PDF for accessibility.
First, you need to set the output format to PDF/UA with
<PDFOptions format="PDF/UA" />
Tagged PDF also needs an outline of the structure of the document. See the previous blog entry for more details on tagged PDF. To summarize: you create an description of what is visible in the PDF. Each visible part gets tagged with a structure type (“this is a label for a table of contents link”, “this is a heading” and so on).
The new command <StructureElement>
in the speedata Publisher adds an entry to a hierarchical list. For example
<StructureElement role="Document">
<StructureElement role="Sect">
<StructureElement role="Art" />
<StructureElement role="Art" />
</StructureElement>
<StructureElement role="Sect">
<StructureElement role="Art" />
<StructureElement role="Art" />
</StructureElement>
</StructureElement>
creates two sections in document, each section contains two articles. To add text or images to a structure part, you need to create a unique id for entry, for example:
<StructureElement role="Document">
<StructureElement role="Sect">
<StructureElement role="Art" id="s1a1" />
<StructureElement role="Art" id="s1a2" />
</StructureElement>
<StructureElement role="Sect">
<StructureElement role="Art" id="s2a1" />
<StructureElement role="Art" id="s2a2" />
</StructureElement>
</StructureElement>
and add contents to the structure, for example:
<PlaceObject>
<Textblock>
<Paragraph role="H1" parent="s1a1">
<Value>A short story</Value>
</Paragraph>
<Paragraph role="P" parent="s1a1">
<Value select="sd:dummytext()" />
</Paragraph>
</Textblock>
</PlaceObject>
This adds a level 1 heading and a paragraph to the first article in the first section (id s1a1).
The document has the following outline:
Dynamic structure elements.
Depending on the data, you may not be able to predict the structure elements. Therefore you can add a child entry to a parent when you pass a parent id:
<StructureElement role="Document" id="doc" />
<StructureElement role="Sect" id="s1" parent="doc" />
<StructureElement role="Sect" id="s2" parent="doc" />
<StructureElement role="Art" id="s1a1" parent="s1" />
<StructureElement role="Art" id="s1a2" parent="s1" />
<StructureElement role="Art" id="s2a1" parent="s2" />
<StructureElement role="Art" id="s2a2" parent="s2" />
This is equivalent to the example at the beginning.
Defaults
The speedata Publisher starts with a default root element:
<StructureElement role="Document" id="doc" />
and the default parent of each element that is placed in the PDF is doc
, so each element is a direct child of the document, unless you provide a different structure.