We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Font is different in jpg file while converting pptx to jpg

I am using following psuedo code for converting pptx to jpg/png.

but when it got completed, the jpg/png file generated having different font and slightly different style from original pptx.

1. pptx file
2. Amatil Fuze screen.jpg (with mismatched fonts and style)
3. Amatil Fuze screen1.jpg (actual image should be like this)

using (Presentation pres = new Presentation(file.InputStream))
for (int i = 0; i < pres.Slides.Count; i++)
//Access the first slide
ISlide sld = pres.Slides[i];

//User defined dimension
int desiredX = 1920;
int desiredY = 1440;

//Getting scaled value of X and Y
float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;

//Create a full scale image
Bitmap bigImage = sld.GetThumbnail(ScaleX, ScaleY);

string outputFileName = string.Format(targetFile, maxSlideIndex + i + 1);

//Save the image to disk in PNG format
bigImage.Save(outputFileName, ImageFormat.Png);

//Removing white border
using (Bitmap bmpImage = new Bitmap(outputFileName))
System.Drawing.Rectangle cropArea = new System.Drawing.Rectangle(1, 1, bmpImage.Width - 1, bmpImage.Height - 1);
resize = new Bitmap(bmpImage);
resize = resize.Clone(cropArea, bmpImage.PixelFormat);

//Saving as JPEG
resize.Save(outputFileName, ImageFormat.Jpeg);
int slideIndexId = maxSlideIndex + i + 1;
story.Slides.Add(new StorySlide() { SlideIndex = slideIndexId, Type = “JPG”, IsCoverPage = slideIndexId == 0 ? true : false, CategoryId = 0, Calculations = string.Empty, leaf = true, Title = string.Empty, Question = string.Empty });

Hi Shoaib,

Thank you for posting.

I have observed your comments and like to share with you that I am unable to use the code shared by you because it has dependencies like resize, storyslide. I request you to please share with us a narrowed down sample code to reproduce the issue. However, I have tried to convert pptx to jpg, myself and I am unable to notice the issue. The generated image appears the way PowerPoint displays it. For font related issue on your end, I request you to please try using Aspose.Slides for .NET 16.1.0 while loading the font, which is being used in the presentation, externally as explained over this link.

Please let us know if the issue persists. We will be glad to help you further.

Best Regards,

Thanks for your reply,

It seems like this font was not installed on my machine that was the actual issue. this font is probably included in Microsoft office and my machine doesn’t have office installed .

thanks anyways

Hi Shoaib,

We are glad to know that the issue has been diagnosed and resolved. Please feel free to contact us if we can be of any help to you.

Best Regards,