-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Combine existing SVG files #53
Comments
Victor was not designed for this, it was designed to generate SVG from within Ruby, from scratch. However, you might be able to use the Notice, you will need to obtain the SVG string without any of its surrounding Here is a sample, to hopefully get you on the right track. This takes two SVG strings, and merges them into one SVG object, while transforming (moving) one of them to a certain position. require 'victor'
include Victor
logo = '<rect x="0" y="0" width="50" height="50" fill="red"/>'
qrcode = '<circle cx="50" cy="60" r="20" fill="yellow"/>'
svg = SVG.new viewBox: '0 0 100 100', style: { background: "#ddd" }
svg.build do
append logo
g(transform: "translate(10 10)") { append qrcode }
end
svg.save 'merged' Remember, the |
Thanks for the quick reply @DannyBen, the info helps a lot. I've found this method in Victor::CLI::SVGNode.load_file |
Closing the issue, never the less I think it would be nice to be able to open existing SVG to append things to them. ;) |
Hi there, I have a use case that I'm not sure how to address with this gem.
I need to conbine 2 SVG files:
I've checked
victor-cli
a little bit and I think it can help with me with this problem, just not sure how.Is there a tool or method I'm missing that can accomplish that?
Thanks!
The text was updated successfully, but these errors were encountered: