WriteAsSvg Black Background (Transparency?)

I am trying to export slides using the writeAsSvg function with a memory stream.

The svgs are created fine but they all have a black slide background. The powerpoint file itself has a solid white background and 0% transparency.

Any thoughts?

Hi Peter,

Thank you for considering Aspose.

Please share your input, output file and sample code with us to reproduce the issue at our end. We will check it and get back to you soon.

Thanks & Regards,

using (Presentation pres = new Presentation(presentationFile))
{

//atempt to rectify black background
//pres.Masters[0].Background.Type = BackgroundType.OwnBackground;
//pres.Masters[0].Background.FillFormat.FillType = FillType.Solid;
//pres.Masters[0].Background.FillFormat.SolidFillColor.Color = Color.White;

//Access all the slides
foreach (ISlide sld in pres.Slides)
{
string slideTitle = "";

//Iterate through shapes to find the placeholder
foreach (Shape shp in sld.Shapes)
if (shp.Placeholder != null)
{
if (IsTitleShape(shp))
{
slideTitle = ((AutoShape)shp).TextFrame.Text;
}
}

Slide slide = new Slide(sld.SlideNumber.ToString(), sld.SlideNumber.ToString(), slideTitle);


Bitmap bmp = sld.GetThumbnail(1f, 1f);
//Save the image to disk in JPEG format

string filePath = Server.MapPath("images/") + pres.DocumentProperties.Title + "/";

bmp.Save(filePath + sld.SlideNumber.ToString() + ".png", System.Drawing.Imaging.ImageFormat.Png);

Presentation tempPres = new Presentation();
tempPres.Slides.AddClone(sld);
tempPres.Slides.RemoveAt(0);
tempPres.Save(filePath + sld.SlideNumber.ToString() + ".html", Aspose.Slides.Export.SaveFormat.Html);

//Create a memory stream object
MemoryStream SvgStream = new MemoryStream();

//Generate SVG image of slide and save in memory stream
sld.WriteAsSvg(SvgStream);
SvgStream.Position = 0;

//Save memory stream to file
using (Stream fileStream = System.IO.File.OpenWrite(filePath + sld.SlideNumber.ToString() + ".svg"))
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
{
fileStream.Write(buffer, 0, len);
}

}
SvgStream.Close();

slides.Add(slide);
}
}

return slides;
} using (Presentation pres = new Presentation(presentationFile))
{

//atempt to rectify black background
//pres.Masters[0].Background.Type = BackgroundType.OwnBackground;
//pres.Masters[0].Background.FillFormat.FillType = FillType.Solid;
//pres.Masters[0].Background.FillFormat.SolidFillColor.Color = Color.White;

//Access all the slides
foreach (ISlide sld in pres.Slides)
{
string slideTitle = "";

//Iterate through shapes to find the placeholder
foreach (Shape shp in sld.Shapes)
if (shp.Placeholder != null)
{
if (IsTitleShape(shp))
{
slideTitle = ((AutoShape)shp).TextFrame.Text;
}
}

Slide slide = new Slide(sld.SlideNumber.ToString(), sld.SlideNumber.ToString(), slideTitle);


Bitmap bmp = sld.GetThumbnail(1f, 1f);
//Save the image to disk in JPEG format

string filePath = Server.MapPath("images/") + pres.DocumentProperties.Title + "/";

bmp.Save(filePath + sld.SlideNumber.ToString() + ".png", System.Drawing.Imaging.ImageFormat.Png);

Presentation tempPres = new Presentation();
tempPres.Slides.AddClone(sld);
tempPres.Slides.RemoveAt(0);
tempPres.Save(filePath + sld.SlideNumber.ToString() + ".html", Aspose.Slides.Export.SaveFormat.Html);

//Create a memory stream object
MemoryStream SvgStream = new MemoryStream();

//Generate SVG image of slide and save in memory stream
sld.WriteAsSvg(SvgStream);
SvgStream.Position = 0;

//Save memory stream to file
using (Stream fileStream = System.IO.File.OpenWrite(filePath + sld.SlideNumber.ToString() + ".svg"))
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
{
fileStream.Write(buffer, 0, len);
}

}
SvgStream.Close();

slides.Add(slide);
}
}

return slides;
}

Thanks. Code snippet and files above.

Hi Peter,

Thank you for sharing the template file.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: SLIDESNET-35788. You will be notified via this forum thread once the issue gets resolved.

Thanks & Regards,

Thanks.

Further to this I notice charts and pngs also export to svg with a black background. Do you have an idea if this is likely to be resolved soon? We bought Slides.net primarily on the back of this functionality and we can't use it.

Hi Peter,

Thank you for the details.

Please share the sample files for the issues of charts and png exports to further test the issue at our end. We will check it and get back to you.

Regarding the previously reported issue, it is pending of further investigation on development team’s end. As soon as the investigation is done and some ETA is shared, we will update you via this forum thread.

Thanks & Regards,

The issues you have found earlier (filed as SLIDESNET-35788) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.