-
Notifications
You must be signed in to change notification settings - Fork 259
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 rendering #1147
Comments
I don't know much about SVG but taking a quick look I believe the problem is the clipping path being painted. def build_clipping_path(self, shape, clip_id):
if shape.tag in shape_tags:
shape_builder = getattr(ShapeBuilder, shape_tags[shape.tag])
clipping_path_shape = shape_builder(shape, True)
elif shape.tag in xmlns_lookup("svg", "path"):
clipping_path_shape = PaintedPath()
apply_styles(clipping_path_shape, shape)
clipping_path_shape.paint_rule = PathPaintRule.DONT_PAINT # line added
svg_path = shape.attrib.get("d")
if svg_path is not None:
svg_path_converter(clipping_path_shape, svg_path)
else:
LOGGER.warning(
"Ignoring unsupported <clipPath> child tag: <%s> (contributions are welcome to add support for it)",
without_ns(shape.tag),
)
return
self.update_xref(clip_id, clipping_path_shape) @Lucas-C can you please check if it makes sense? |
hi @andersonhc , thank for looking into this. Do you have a fork/branch that I can check out to have a look? |
Hey @RubendeBruin Here is the branch I created: Is it OK using your file on a unit test? |
Hi @andersonhc , |
I'm rendering a .svg image (attached). In 2.7.6 this worked fine, in 2.7.7 it broke and in 2.7.8 the result is incorrect.
Version 2.7.6:
Renders OK:
Version 2.7.7:
Fails with
Version fpdf2-2.7.8 (including current master branch): Renders incorrectly
Minimal code
Environment
Please provide the following information: Windows 11, Python 3.11
Reference SVG:
The text was updated successfully, but these errors were encountered: