White space is getting added for Inserted SVG images (C# .NET)

I am generating PPT slides and inserting svg images. When the slide is created, the Aspose library is [sometimes] adding white space around the image (see screenshot). This only appears to be happening on my machine, and only occurs ~50% of the time. There is another developer who is able to create slides off the same exact images and they are not running into this issue.

To create the image, we are converting a base 64 string into an svg and then loading them into Aspose. Here are the relevant commands we are using:

var svgImage = new SvgImage(Convert.FromBase64String(fc.FileImage))
presentation.Images.AddImage(svgImage);

image.png (29.5 KB)

Below I have included the Base64 string for your reference.

Any ideas why I am seeing extra white space around my images?

Thanks!

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iNTc4LjI1cHQiIGhlaWdodD0iMzg4LjVwdCI+DQogPGcgaWQ9IlNGaXhUaXRsZSIgLz4NCiA8ZyBpZD0iU0NvbnRlbnQiPg0KICA8ZyB0cmFuc2Zvcm09InNjYWxlKDEuMzMzMzMpIj4NCiAgIDxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMCwwKSI+DQogICAgPGc+DQogICAgIDxwYXRoIGQ9Ik0wLDAgTDU3OC4yNSwwIEw1NzguMjUsMzg4LjUgTDAsMzg4LjUgWiAiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIwIiBmaWxsPSIjRkZGRkZGIiBmaWxsLW9wYWNpdHk9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMCwwKSIgLz4NCiAgICAgPHBhdGggZD0iTTc4Ljc1LDM0MiBMNTcwLjc1LDM0MiAiIHN0cm9rZT0iI0Q5RDlEOSIgc3Ryb2tlLW9wYWNpdHk9IjEiIHN0cm9rZS13aWR0aD0iMC43NSIgc3Ryb2tlLWxpbmVjYXA9ImJ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BmaWxsPSIjNTk1OTU5Ij4zNS4wJTwvdGV4dD4NCiAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgIDwvZz4NCiAgICAgPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwwLDApIj4NCiAgICAgIDxnPg0KICAgICAgIDxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMTMuMjQ0MTQwNjMsNjAuNTgyMDMxMjUpIj4NCiAgICAgICAgPHRleHQgeD0iMCIgeT0iLTUiIGZvbnQtZmFtaWx5PSJDYWxpYnJpIiBmb250LXNpemU9IjIwIiBmaWxsPSIjNTk1OTU5Ij40MC4wJTwvdGV4dD4NCiAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgIDwvZz4NCiAgICA8L2c+DQogICA8L2c+DQogIDwvZz4NCiA8L2c+DQogPGRlZnMgLz4NCjwvc3ZnPg0K

@adamtrien,

I have observed the issue shared by you and request you to please share the source SVG file along with source presentation (if any ) and generated output presentation. Please also share the sample code that you have used too. I am assuming that you have tried using Aspose.Slides for .NET 20.2 on your end for your testing.

I have been testing on 20.1 but I will switch to 20.2 and run more tests. In the original post I included the Base64 string that I am converting to an svg on-the-fly to load into the presentation. Here is the code I am using:

var svgImage = new SvgImage(Convert.FromBase64String(fc.FileImage))
presentation.Images.AddImage(svgImage);

The exact same image/code works properly on other people’s development machines which leads me to believe it is not an issue w/ the SVG itself. This problem occurs on any SVGs that I attempt to load, not just this specific one.

Thanks,
Adam

@adamtrien,

Thank you for sharing the feedback with us and for your explanation the issue is only getting reproduced on your machine for any SVG you use. Where as there is no issue incurring for same SVG on others machine. Can you please share the machine specifications where things are working fine and your machine specification where things are failing. Please also provide a workable sample code along with generated output presentation with us for reference.