Closed vinithius2 closed 4 years ago
Could you please provide the .svg intermediate file?
@claudep follow this zip file, github not accept svg file.
Thanks. I identified the issue being this rect: <rect class="scrollbar" rx="20" ry="3" width="0" height="0" style="fill: rgb(128, 139, 164); fill-opacity: 1;" x="0" y="0"/>
where the rx/ry values are greater than height and width.
The specs say: If rx is greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle.
The other issue being the border rect is displayed even with stroke-width: 0px;
.
@replabrobin, sorry I don't find the new issue location for reportlab. There is a remaining issue here that a rect is stroked even with a strokeWidth to 0. Minimal example:
<svg class="main-svg" xmlns="http://www.w3.org/2000/svg" width="700" height="500" style="" viewBox="0 0 700 500">
<rect class="bg" shape-rendering="crispEdges" style="stroke: rgb(0, 0, 0); fill: rgb(255, 255, 255); fill-opacity: 1; stroke-width: 0;" width="135" height="86" x="10" y="10"/>
</svg>
which gives a <reportlab.graphics.shapes.Rect object>
with the following properties:
{'fillColor': Color(1,1,1,1), 'fillOpacity': 1.0, 'strokeColor': Color(0,0,0,1), 'strokeWidth': 0.0, 'strokeLineCap': 0, 'strokeLineJoin': 0, 'strokeMiterLimit': 0, 'strokeDashArray': None, 'strokeOpacity': 1.0, 'x': 10.0, 'y': 10.0, 'width': 135.0, 'height': 86.0, 'rx': 0.0, 'ry': 0.0, '_fillRule': 1}
Do you have any idea why this rectangle is drawn by ReportLab even with strokeWidth to 0?
Hi Claude, the strokeWidth==0 case is special in PDF which is why we have it still drawing. Andy Robinson told me that a stroke width of 0 is used by PDF renderers to draw the thinnest possible line in the medium they render to.
Quoting from the PDF 1.7 spec
"A line width of 0 denotes the thinnest line that can be rendered at device resolu- tion: 1 device pixel wide. However, some devices cannot reproduce 1-pixel lines, and on high-resolution devices, they are nearly invisible. Since the results of ren- dering such zero-width lines are device-dependent, their use is not recommend- ed."
To eliminate a stroke in PDF we need to set the stroke colour to None.
That's a pretty precious information to have. Thanks a lot! I think we can rather easily workaround that issue, now.
I want to remove this little star, the problem is with the svg2rlg library and not with Plotly, I did a little test, follow the small script and the results:.
Result using the svg2rlg library to convert SVG to ReportLab:![enter image description here](https://i.stack.imgur.com/BLoUq.png)
Plotly Result:![enter image description here](https://i.stack.imgur.com/tVGSK.png)
Was install...
Topic open in community: https://community.plotly.com/t/how-do-i-remove-this-star-from-the-legend/43994/2 Stackoverflow: https://stackoverflow.com/questions/63493551/remove-star-from-svg2rlg-with-reportlab