Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toBlob throws an error with react-pdf elements (Svg, Defs) #2644

Open
Scott-Kinzer opened this issue Feb 15, 2024 · 2 comments
Open

toBlob throws an error with react-pdf elements (Svg, Defs) #2644

Scott-Kinzer opened this issue Feb 15, 2024 · 2 comments

Comments

@Scott-Kinzer
Copy link

Describe the bug
toBlob throws an error with some react-pdf elements (Svg, Defs)
Error: renderFn is not a function

To Reproduce
Next.js,
react-pdf version: 3.3.8

With Defs, toBlob throws an error, but if I delete it and add a standard fill color to the circle, it works correctly.

  <G>
    <Defs>
        <LinearGradient id="myLinearGradient">
          <Stop offset="5%" stopColor="gold" />
          <Stop offset="95%" stopColor="red" />
        </LinearGradient>
      </Defs>
    <Circle cx="5" cy="5" r="4" fill="url(‘#myLinearGradient’)" />
  </G>
@Tommy052
Copy link

I have the same problem😭😭😭 < Defs> Without Tegg, no problem will arise.

@obi-awyss
Copy link
Contributor

It looks like In reaact-pdf Defs is only supported as a child of Svg

This PR #2836
will at least write to the console the original problem instead of throwing the error: "Error: renderFn is not a function"

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

No branches or pull requests

3 participants