WCAG best practices - print templates (low-code)
Free tools for verifying print accessibility
PAC
PAC - https://pac.pdf-accessibility.org/en (Windows) - a tool used to check whether PDF files meet accessibility requirements. Using it you can verify if your PDF complies with PDF/UA and WCAG standards and generate a report based on that. It also allows previewing the document structure for a screen reader.



Axes4
Axes4 - https://check.axes4.com/en/ - an online tool that generates an accessibility report. It is limited compared to PAC in terms of more detailed analysis with error indication and lacks the ability to preview the PDF structure.

Screen readers
Information is located here
Print metadata declarations
In the context of accessibility <fo:declarations> we can declare metadata or other additional information that does not directly affect visual formatting.
<fo:declarations> for proper operation it must be located in the document structure between the tag <fo:layout-master-set>, and the first <fo:page-sequence>
Screen readers may interpret these values. According to the assumptions of UA and WCAG the metadata should include the document title, language and the DisplayDocTitle setting. Example declaration:
<fo:declarations>
<pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
<pdf:string key="Lang">pl</pdf:string> <- declaration of the language
<pdf:dictionary type="normal" key="ViewerPreferences">
<pdf:boolean key="DisplayDocTitle">true</pdf:boolean> <- DisplayDocTitle setting
</pdf:dictionary>
</pdf:catalog>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>Dokument AwZ</dc:title> <- title
<dc:creator>Document author</dc:creator> <- author
<dc:description>Dokument AwZ</dc:description> <- description
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
</fo:declarations>Assigning the correct tag to email addresses and links
Email addresses and links to external addresses should be contained within the context of the tag <fo:basic-link>
field
<xsl:variable name="wnioskodawca_email"
select="//wnio:AdresZamieszkania/wnio:AdresPocztyElektronicznej"></xsl:variable>
<xsl:variable name="wnioskodawca_email_link"
select="concat('mailto:', '$wnioskodawca_email')"></xsl:variable>
...
<fo:basic-link>
<xsl:attribute name="external-destination">
<xsl:value-of select="$wnioskodawca_email_link"/>
</xsl:attribute>
<xsl:value-of select="$wnioskodawca_email" />
</fo:basic-link>Modifying element roles
By default elements are automatically assigned corresponding types in the generated PDF structure (H1 to H6 for headings, L for lists, etc.). However, it is possible to override the default roles if we want to improve the default structure using the "role" attribute.
The default <fo:block> is assigned the role <p>.
...
<fo:block role="H1" font-weight="bold">Header with H1 tag</fo:block>
<fo:block>Paragraph in the section</fo:block>
...To skip certain elements in the PDF structure so they are not visible to the screen reader, we can use role="artifact". This is useful to omit in the structure, for example, elements like <fo:static-content> such as page headers and footers, which are unhelpful to blind users when read by a screen reader.
Example usage for a header:
<fo:static-content flow-name="first-page-header" role="artifact">
<xsl:call-template name="naglowek1"></xsl:call-template>
</fo:static-content>There is also the possibility of "wrapping" content that we want to omit in the PDF structure using the element <fo:wrapper> with the role "artifact" assigned.
Example for presenting a date format dd-mm-yyyy under a field:
<fo:block text-align="center" font-weight="bold">
<fo:wrapper role="artifact">dd - mm - yyyy</fo:wrapper>
</fo:block>Presentation of empty cells
For creating elements that do not need to present values and may be empty, a non-breaking space or characters in the same color as the print background should not be used.
Example of a template for an unchecked checkbox causing an accessibility report error due to using color="white", which results in displaying a white character on a white background:
xsl:template name="checkbox_template">
<xsl:param name="checked"></xsl:param>
<xsl:choose>
<xsl:when test="$checked = 'true'">
<fo:inline font-family="ZapfDingbats" font-size="10pt" min-width="12mm">✕</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline font-family="ZapfDingbats" font-size="10pt" color="white" width="100mm">
✕</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Instead of it, it is better to create an empty cell with the style padding-top and padding-bottom, which will visually give us the same cell appearance without the need for any unnecessary character to be present.
<xsl:template name="checkbox_template">
<xsl:param name="checked"></xsl:param>
<xsl:choose>
<xsl:when test="$checked = 'true'">
<fo:block font-size="8pt" min-width="12mm" padding-top="0.1mm" padding-bottom="0.1mm">X</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block width="100mm" padding-top="2mm" padding-bottom="1.5mm"></fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:template>Spacing between elements - avoiding empty rows
It is bad practice to use elements such as fo:block with non-breaking space characters to increase spacing between elements on the print. The same effect can be achieved using styles such as margin-top and margin-bottom. This will help avoid unnecessary empty elements in the document structure.
If you want to increase spacing between rows <fo:table-row> you can use table properties border-collapse="separate" and border-spacing="...".
For example:
<fo:table border-collapse="separate" border-spacing="10pt">
<fo:table-body>
<fo:table-row>
<fo:table-cell border="solid 1pt black">
<fo:block>Row 1</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border="solid 1pt black">
<fo:block>Row 2</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>Last updated
Was this helpful?
