Kozea/WeasyPrint

SVG: Unable to specify an alt text for screen readers

Open

#2,816 opened on Jun 29, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Python (630 forks)batch import
featuregood first issue

Repository metrics

Stars
 (6,291 stars)
PR merge metrics
 (Avg merge 14d 23h) (10 merged PRs in 30d)

Description

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

Contributor guide