You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logging.error("Unsupported shape type %s for clipping", shape.__class__.__name__)
This is caused from the convertShape function where, if there is a transform, then it will add the shape to a group and apply the transform to the group instead of the shape.
"""Converter from SVG shapes to RLG (ReportLab Graphics) shapes."""
defconvertShape(self, name, node, clipping=None):
method_name=f"convert{name.capitalize()}"
shape=getattr(self, method_name)(node)
ifnotshape:
return
ifnamenotin ('path', 'polyline', 'text'):
# Only apply style where the convert method did not apply it.
self.applyStyleOnShape(shape, node)
transform=node.getAttribute("transform")
ifnot (transformorclipping):
returnshape
else:
group=Group()
iftransform:
self.applyTransformOnGroup(transform, group)
ifclipping:
group.add(clipping)
group.add(shape)
returngroup
I did a quick test and applied the transform directly on the path element and everything seemed to work fine, however I'm not sure if there are any unintended side effects from doing it this way. Is this an intended feature or could I work on a patch to add an optional argument to apply the transformation directly for this use case?
Edit: I doubled checked the output and the transformed path was not placed or transformed correctly so additional work may be needed with this part.
The text was updated successfully, but these errors were encountered:
I don't remember if the fact to apply transforms only on shapes was a conveniency, or if it was required. Feel free to experiment and suggest changes if they are successful.
When clipPaths contain a path with a transform, the path is ignored and discarded with the error message
Unsupported shape type Group for clipping
.The svg I am testing with is the following:
I don't believe this was happening with earlier versions so I decided to do some digging and narrowed the problem down.
The error that is displayed starts here, when the detected shape from the node is neither a Path or a Rect despite the svg using a path element.
svglib/svglib/svglib.py
Lines 655 to 656 in 9a43d4f
This is caused from the convertShape function where, if there is a transform, then it will add the shape to a group and apply the transform to the group instead of the shape.
svglib/svglib/svglib.py
Lines 895 to 916 in 9a43d4f
I did a quick test and applied the transform directly on the path element
and everything seemed to work fine, however I'm not sure if there are any unintended side effects from doing it this way. Is this an intended feature or could I work on a patch to add an optional argument to apply the transformation directly for this use case?Edit: I doubled checked the output and the transformed path was not placed or transformed correctly so additional work may be needed with this part.
The text was updated successfully, but these errors were encountered: