Skip to content

Support SVG switch elements - #1892

Merged
andersonhc merged 2 commits into
py-pdf:masterfrom
dannymaaz:feature/svg-switch
Jul 24, 2026
Merged

Support SVG switch elements#1892
andersonhc merged 2 commits into
py-pdf:masterfrom
dannymaaz:feature/svg-switch

Conversation

@dannymaaz

Copy link
Copy Markdown

Summary

  • add basic SVG <switch> support
  • select the first child without conditional processing attributes
  • skip environment-dependent alternatives so an unconditional fallback can render
  • update the SVG support documentation

Why

<switch> was ignored by the SVG parser, causing SVGs that use fallback graphics to render blank in that section.

Validation

  • ruff check fpdf/svg.py test/svg/test_svg.py
  • python -m pytest test/svg/test_svg.py -q (276 passed)

Checklist

  • A unit test covers the change.
  • Documentation and changelog entries are included.
  • This pull request is ready for review.

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

@dannymaaz
dannymaaz marked this pull request as ready for review July 21, 2026 05:06

@andersonhc andersonhc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the contribution @dannymaaz
I'm good to merge the PR

@andersonhc

Copy link
Copy Markdown
Collaborator

@allcontributors please add @dannymaaz for code

@allcontributors

Copy link
Copy Markdown

@andersonhc

I've put up a pull request to add @dannymaaz! 🎉

@andersonhc
andersonhc merged commit 080b473 into py-pdf:master Jul 24, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants