Free Support Forum - aspose.com

SVG added to slide not displayed correctly

Some SVG’s are not added correctly to a presentation. (Version .Net 20.12.0 is used)

Below some sample code with a sample SVG as string to reproduce the issue.
The same SVG could be added to PowerPoint by using the application from Microsoft without any issues.

using System;
using System.Drawing;
using System.Linq;
using Aspose.Slides;
using Aspose.Slides.Export;

namespace Slides.Tests
{
	public class IssuesTest 
	{
		public void AddSvg()
		{
			const string svg = @"<?xml version=""1.0"" encoding=""utf-8""?>
<svg version=""1.1"" xmlns=""http://www.w3.org/2000/svg"" xmlns:xlink=""http://www.w3.org/1999/xlink"" x=""0px"" y=""0px""
	 viewBox=""0 0 24 24"" style=""enable-background:new 0 0 24 24;"" xml:space=""preserve"">
<style type=""text/css"">
	.st0{display:none;}
	.st1{display:inline;}
	.st2{fill:none;stroke:#00FF00;stroke-width:5.000000e-02;stroke-linejoin:round;stroke-miterlimit:10;}
	.st3{fill:none;stroke:#00FF00;stroke-width:5.000000e-02;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:10;}
	.st4{fill:#8DBFCF;}
	.st5{fill:none;stroke:#8DBFCF;stroke-linejoin:round;}
	.st6{fill:none;}
</style>
<g id=""Guides_x2B_Names"" class=""st0"">
	<g id=""Check_1_"" class=""st1"">
		<g id=""Grid_3_"">
			<circle id=""Grid_Circle_3_"" class=""st2"" cx=""12"" cy=""12"" r=""10""/>
			<path id=""Grid_Rectangle_II_3_"" class=""st2"" d=""M22,6.5C22,6.2,21.8,6,21.5,6h-19C2.2,6,2,6.2,2,6.5v11C2,17.8,2.2,18,2.5,18h19
				c0.3,0,0.5-0.2,0.5-0.5V6.5z""/>
			<path id=""Grid_Rectangle_I_3_"" class=""st2"" d=""M17.5,22c0.3,0,0.5-0.2,0.5-0.5v-19C18,2.2,17.8,2,17.5,2h-11C6.2,2,6,2.2,6,2.5
				v19C6,21.8,6.2,22,6.5,22H17.5z""/>
			<path id=""Grid_Square_3_"" class=""st2"" d=""M20,4.5C20,4.2,19.8,4,19.5,4h-15C4.2,4,4,4.2,4,4.5v15C4,19.8,4.2,20,4.5,20h15
				c0.3,0,0.5-0.2,0.5-0.5V4.5z""/>
		</g>
	</g>
</g>
<g id=""Icons"">
	<g id=""Check"">
		<path class=""st4"" d=""M9,16.7c-0.1,0-0.3,0-0.4-0.1l-3-3l0.7-0.7L9,15.5l8.6-8.6l0.7,0.7l-9,9C9.3,16.6,9.1,16.7,9,16.7z""/>
	</g>
	<rect class=""st6"" width=""24"" height=""24""/>
</g>
</svg>
";

			using (var presentation = new Presentation())
			{
				var image = presentation.Images.AddImage(new SvgImage(svg));
				var shape = presentation.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 100, 100, 24, 24, image);
				
				presentation.Save(@"Svg.pptx", SaveFormat.Pptx);
			}
		}
	}
}

@bitterlich

Can you please share the generated presentation and also comparison image between SVG and presentation that is actually representating the issue.

You could have easily created those outputs with the code I’ve supplied.

Anyway, here an image.png (61.6 KB) with the proper SVG on the right side (displayed in Chrome) and the result in the created PowerPoint on the left side (selected item).

And this is the PPTX created with the code above. Svg.zip (23.3 KB)

Best regards

@bitterlich

Thank you for sharing the information with us. A ticket with ID SLIDESNET-42376 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESNET-42376) have been fixed in this update. This message was posted using Bugs notification tool.