Forum How do I...?

How do I create alternative texts ("alt" attribute) for XML SVGs?

twantzen
We are exporting PDF/UA-1 conform PDFs meet as much accessibility requirements as possible.

If I use base64 encoded SVGs in a <img> container, I can easily define an "alt" attribute. But we do have some SVGs, that are inserted as XML (in order to redefine colors inside the XML depending on which page they are displayed, e.g.).
I tried some hints which I found on Google, but none of them truely worked: The PAC (https://pac.pdf-accessibility.org) always showed me an error for the XML SVGs.

Does anyone have experience with this topic in combination with PrinceXML and can give me some advice on what exactly to do?

Thanks,
Tobias
wangp
If you mean you are including the SVG inline in the HTML document, you can add a <title> or <desc> element to the SVG.
<svg width="12cm" height="4cm" viewBox="0 0 1200 400">
  <desc>Example rect01 - rectangle with sharp corners</desc>
  <rect x="400" y="100" width="400" height="200"
        fill="yellow" stroke="navy" stroke-width="10"  />
</svg>
twantzen
Thanks, wangp, I meant "SVG inline" and I'll give this a try.