Hi,
I’m using Aspose Slides .NET version 23.12.0 and found an issue with it.
Here is the step to reproduce:
Open input file and save it as a ppt file:
var inputPpt = @"D:\\sample_A.ppt";
var outputPpt = @"D:\\sample_B.ppt";
using (var inputStream = new FileStream(inputPpt, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
Presentation presentation = null;
presentation = new Presentation(inputStream);
presentation.Save(outputPpt, SaveFormat.Ppt);
}
After above, we got 2 file sample_A.ppt and file sample_B.ppt is created from sample_A.ppt
Next step is save these 2 ppt file to jpg format using this code:
var inputPpt = @"D:\\sample_A.ppt";
var outputJpgLocation = @"D:\\sample_A"; // this is a folder
var options = System.Drawing.Imaging.ImageFormat.Jpeg;
using (var presentation = new Presentation(inputPpt))
{
for (int i = 0; i < presentation.Slides.Count; i++)
{
var sld = presentation.Slides[i];
var img = sld.GetThumbnail(1f, 1f);
slideName = Path.Combine(outputJpgLocation, "Slide" + (i + 1) + ".jpg");
img.Save(slideName, options);
}
}
Do the same with file sample_B.ppt then we will have 2 different collection of images, and there are problem for file Slides_2.jpg, when some characters are uppercase.
image.png (52.1 KB)
Here is the sample_A,ppt file, sample_B.ppt file, and the output of them when converting to JPG.
A.zip (70.0 KB)
The issue happen with other language like Bulgarian, Portuguese and Turkish.
Please help me to check if I’m wrong at some points or something else.
Thank you.
@dunghnguyen,
Sorry for the delay.
We will be looking into your issue and get back to you soon.
@dunghnguyen,
I tested your scenario/case using your sample PPT file(s) and following code segment with latest version of Aspose.Slides for .NET v23.12. I got right results, the output JPG files (attached) are ok and I do not find any issue where some characters are uppercase for slide2.
e.g.
Sample code:
var inputPpt = "F:\\test2\\issue when saving\\sample_A.ppt";
var outputPpt = "F:\\test2\\issue when saving\\sample_B.ppt";
using (var inputStream = new System.IO.FileStream(inputPpt, System.IO.FileMode.Open,
FileAccess.Read, FileShare.ReadWrite))
{
Aspose.Slides.Presentation presentation = null;
presentation = new Aspose.Slides.Presentation(inputStream);
presentation.Save(outputPpt, Aspose.Slides.Export.SaveFormat.Ppt);
}
inputPpt = "F:\\test2\\issue when saving\\sample_B.ppt";
var outputJpgLocation = "F:\\test2\\"; // this is a folder
var options = System.Drawing.Imaging.ImageFormat.Jpeg;
using (var presentation = new Aspose.Slides.Presentation(inputPpt))
{
for (int i = 0; i < presentation.Slides.Count; i++)
{
var sld = presentation.Slides[i];
var img = sld.GetThumbnail(1f, 1f);
string slideName = Path.Combine(outputJpgLocation, "Slide" + (i + 1) + ".jpg");
img.Save(slideName, options);
}
}
Slide1.jpg (18.5 KB)
Slide2.jpg (21.5 KB)
I am testing your scenario/case on Windows10 with us-english locale.
Did you test your scenario on us-english locale? Do you only get issue on Bulgarian, Portuguese and Turkish languages or locales?
Hi @amjad.sahi ,
Sorry for my late response. I’ve re-checked my project and found that the variable invariantGlobalization
is set to false. This could be the root cause of the difference between the two versions of the converted image. Can you set the value of variable to false and re-check this issue?
Thank you.
@dunghnguyen,
How could I set this variable to “false” either in project settings to reproduce the issue on my end?
Hi @amjad.sahi,
To disable InvariationGlobalization
mode of a C# project, you need to edit the .csproj file of this project and adding the following lines:
<PropertyGroup>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>
You can learn more about this settings here: Globalization config settings - .NET | Microsoft Learn
Let’s me clarify a little bit more about reproduce condition of the issue we’re facing:
- You’ll need two separate projects to reproduce this: one project for loading PPT and save it back to PPT and another project to convert the new PPT into JPEG images.
- The first project (PPT to PPT) must have
InvariationGlobalization
set to true and the second project (PPT to JPG) must have InvariationGlobalization
set to false; in order to reproduce the issue.
- We cannot reproduce the issue if both projects set it to a same value.
Hope this help you in your tests. Thanks!
@dunghnguyen,
I set my preferred language to Portuguese and region to Portugal in Windows settings, then followed the instructions you provided, but unfortunately I was unable to reproduce the problem on my end. Please try to isolate the problem and provide additional information on how to reproduce the problem on our end.