-
Notifications
You must be signed in to change notification settings - Fork 55
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
SVG gradients do not render properly #153
Comments
I tried to replicate this but can't. See _multiple_gradients.pdf which shows two of the SVG you provided displayed on top of each other. Given this is quite old I'll close it for now, but if you can replicate it and provide a code example using only prawn and prawn-svg I'd be happy to look into it. |
I can confirm this is an issue. If you use the following script, you'll see that even though the SVGs are stacked, the gradient is always drawn from the same x,y position on the page, so the second and third SVGs are missing their gradient. require 'prawn'
require 'prawn-svg'
Prawn::Document.generate 'out.pdf' do
svg (File.read 'tmp.drawio.svg'), width: 100
svg (File.read 'tmp.drawio.svg'), width: 100
svg (File.read 'tmp.drawio.svg'), width: 100
end |
Interesting! I had |
I can replicate it (_multiple_gradients.pdf) and the first svg is the one that gets the gradient, no matter where on the screen it is. Looking at the PDF though (upload to https://pdfprettyprint.com if you want a go), all seems fine. I initially thought it was reusing the gradient definitions, but no, each rect has its own gradient, and they're all at different co-ordinates. Looking at the code, I can see nothing except the gradients that get cached in a registry between calls to prawn-svg. Quite confused. If you spot anything in the PDF, do let me know... |
Gist: https://gist.github.com/jwright6323/666747665d920d6bc294959be24f6822
I am seeing that gradients are rendered based on the image's location within a page rather than a component's position within the SVG (see example in Gist above).
The text was updated successfully, but these errors were encountered: