Kozea/WeasyPrint

SVG: Unable to specify an alt text for screen readers

Closed

#2816 aperta il 29 giu 2026

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Python (630 fork)batch import
featuregood first issue

Metriche repository

Star
 (6291 star)
Metriche merge PR
 (Merge medio 14g 23h) (10 PR mergiate in 30 g)

Descrizione

Hello,

I have an SVG image embedded in my HTML file. I want to provide an alt text so that screen readers will provide a description of the image when reading the PDF out loud.

I have provided the tag in my SVG structure:

<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="288pt" height="288pt" viewBox="0 0 288 288" xmlns="http://www.w3.org/2000/svg" version="1.1"><title>Tracé du parcours de la ligne 21.</title>...

and as you can see, it's being picked up by the browser:

However, in the PDF file created by Weasyprint, I don't see any title associated with the SVG file. Nothing is being read by the screen reader.

What is the best way to provide an alt text for svg images?

Here are the HTML and PDF files: SO21-20260106_21001231 (12).html SO21-20260106_21001231 (26).pdf

Thanks

Guida contributor