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

[Bug]: Exception when canvas.toDataURL and certain SVGs #8982

Open
7 tasks done
Sven-Callewaert opened this issue Jun 5, 2023 · 0 comments
Open
7 tasks done

[Bug]: Exception when canvas.toDataURL and certain SVGs #8982

Sven-Callewaert opened this issue Jun 5, 2023 · 0 comments

Comments

@Sven-Callewaert
Copy link

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

5.2.1

In What environments are you experiencing the problem?

No response

Node Version (if applicable)

None

Link To Reproduction

https://jsfiddle.net/wilheim/3kvhzwbn/58/

Steps To Reproduce

  1. Load an SVG with a path that used a gradient for a stroke
  2. Do canvas.toDataURL

Expected Behavior

No exception

Actual Behavior

An error in the console: Uncaught DOMException: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.

The issue is already mentioned in these tickets but is still not resolved:
##7786
##7798

I'm having the issue when I resize this particular SVG to a height of less than 200 pixels.
car

Is there a fix or a workround for this issue?

Error Message & Stack Trace

Uncaught DOMException: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
    at klass._applyPatternForTransformedGradient (http://localhost:8080/js/board/fabric.5.1.0.js:15923:30)
    at klass._setStrokeStyles (http://localhost:8080/js/board/fabric.5.1.0.js:15662:18)
    at klass._renderStroke (http://localhost:8080/js/board/fabric.5.1.0.js:15885:12)
    at klass._renderPaintInOrder (http://localhost:8080/js/board/fabric.5.1.0.js:15828:14)
    at klass._render (http://localhost:8080/js/board/fabric.5.1.0.js:19789:12)
    at klass.drawObject (http://localhost:8080/js/board/fabric.5.1.0.js:15551:12)
    at klass.render (http://localhost:8080/js/board/fabric.5.1.0.js:15409:14)
    at klass.drawObject (http://localhost:8080/js/board/fabric.5.1.0.js:20360:26)
    at klass.renderCache (http://localhost:8080/js/board/fabric.5.1.0.js:15424:14)
    at klass.render (http://localhost:8080/js/board/fabric.5.1.0.js:15403:14)
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

1 participant