Skip to content

Conversation

@exoego
Copy link

@exoego exoego commented Jan 21, 2026

Closes #1622
Closes #1250

Flow

  1. Fetch the .svg image (base64 supported too)
  2. Parse it as DOM using DOMParser in browser (or linkedom in Node.js)
  3. Convert the DOM into react-render <SVG> tag.

Other changes

During tests, I found some features are not working properly, so fixed those.
E.g. rx in rect, stop in gradient.

Attributions to SVG files

I've borrowed a complex SVG which is CC0 license (MIT license compatible) from this web page https://lukaszadam.com/illustrations
<style> tag in the file are converted to inline style since <SVG> seems not to support <style> yet.

Other SVG files are manually crafted.

Screenshot of example :
image

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: ac445c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@react-pdf/vite-example Minor
@react-pdf/layout Minor
@react-pdf/render Minor
@react-pdf/image Minor
@react-pdf/renderer Patch
next-14 Patch
next-15 Patch
@react-pdf/e2e-node-cjs Patch
@react-pdf/e2e-node-esm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@exoego exoego force-pushed the svg-image branch 2 times, most recently from 7ab7c09 to 876df33 Compare January 21, 2026 23:36
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.

Support .svg files in <Image> Support SVG Base64 Images

1 participant