-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
"inherit" doesn’t work for "overflow" #300
Comments
I have a similar issue converting to PNG, but instead of cutting objects, my conversion is corrupted. Should I raise a new issue? |
Ignore this, I've created a separate issue. |
Hello! This issue is caused by the As this property only applies on this short list of tags, the current code assumes that the default value is always "hidden". Unfortunately, it doesn’t work for "inherit", because:
Short answer: as "inherit" is stupidly handled by CairoSVG that doesn’t really use the computed value, it’s broken. Unfortunately, I don’t see how to fix that in an easy way. Handling "inherit" correctly requires a lot of work, and I can’t find an easy workaround. If you have the possibility to add a |
I tried both of your suggestions, but none of them worked. However, I found a workaround, that is simple enough and works just fine in my case: with open(path_to_svg_file, mode="r") as input_file:
svg_stream = input_file.read()
# See https://github.com/Kozea/CairoSVG/issues/300 for the reason why we have to replace inherit with visible here
svg_stream = svg_stream.replace("overflow=\"inherit\"", "overflow=\"visible\"")
output_png = os.path.join(output_directory, os.path.basename(path_to_svg_file).replace("svg", "png"))
svg2png(bytestring=svg_stream, background_color="white", write_to=output_png, output_width=2480, output_height=3508) Feel free to close this issue, unless you want to keep it open as a reminded for fixing how "inherit" works. |
I'm trying to render this file with cairosvg, but unfortunately the image it produces is unusable, because almost all objects are cropped in the upper half like this. Any ideas why this is happening?
My code is simply
Interestingly, the same happens when converting svg to pdf:
0183.pdf
For reference, this is how it should look like:
The text was updated successfully, but these errors were encountered: