Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Unbalanced Padding on SVG with out shadowing

0 votes
On a SVG image generated with out shadowing i.e.
for http://www.plantuml.com/plantuml/uml/AyxEp2j8B4hCLIZEI4p9By_CIrT8IymfJkNYAaXCpavCJrK8TlFrKQZcAafDBadCIyy12bGMbwJc8Wc4P-O1jI89k1Sb5cHa9XSZ2JcMfcJc8_7zKalAyukokMgv8COfsEZfmGo2K60Hk4b8gh29GOn74e2Q3m00
when the SVG result http://www.plantuml.com/plantuml/svg/AyxEp2j8B4hCLIZEI4p9By_CIrT8IymfJkNYAaXCpavCJrK8TlFrKQZcAafDBadCIyy12bGMbwJc8Wc4P-O1jI89k1Sb5cHa9XSZ2JcMfcJc8_7zKalAyukokMgv8COfsEZfmGo2K60Hk4b8gh29GOn74e2Q3m00
is embedded in a webpage, the main element has uneven padding (For visibility use a browsers developer tools to add the "border: 1px dashed #000;" to the svg elements style).
i.e. the frame has bounds of 22, 24, 372, 303 while the view port is set to 0, 0, 373, 304. This gives a left padding of 22 units, top padding of 24 units, and bottom and right padding of 1 units.
When requesting a png image, the left and right padding appear to be balanced.
asked May 31 in bug by anonymous
I found a partial solution, for after inserting the SVG in to a HTML document using java script to fix the view box.

where svg is the svg dom element (taken from the document its inserted to otherwise getBBox dosen't seam to work)

var bb = svg.getBBox();
svg.setAttribute('viewBox', [bb.x, bb.y, bb.width, bb.height].join(" "));
svg.setAttribute('height', bb.height + "px");
svg.setAttribute('width', bb.width + "px");
svg.style.height = bb.height + "px";
svg.style.width = bb.width + "px";

However I suspect this would produce an unbalanced result if the shadow was used as the shadow would be part of the BBox, however I'm unsure of this and haven't tested it.

1 Answer

0 votes
Thanks for the report.

This might have been solved in last beta:

https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0

Very few tests have been done, so tell us if it's ok for you.

Regards,
answered Jun 1 by plantuml (126,850 points)
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...