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

Free Support Forum - aspose.com

Load ppt get exception about datatime error

open_error.zip (3.5 MB)

I use latest aspose.slides .net
q1:when open ppt in my upload zip , get exception about datatime error

q2:

  foreach (var pptImage in ppt.Images)
                {
                    var len = pptImage.BinaryData.Length;
          

                    var fs = new FileStream($@"dump\{Path.GetFileNameWithoutExtension(file)}_{i++}.png",
                        FileMode.Create);
                    BinaryWriter brWriter =
                        new BinaryWriter(fs);
                    brWriter.Write(pptImage.BinaryData);
                    brWriter.Dispose();
                    fs.Dispose();
//  why the  size of output image   do not same as      save image in MS office manauly
// width  height depth  are same, but size of bytes  not same
                }

@lsl,

I have worked with the presentation file shared by you and have been able to receive exception on loading the presentation. An issue with ID SLIDESNET-40809 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.

For you Question 2, I am unable to read your requirements. Can you please share details so that I may proceed further to help you out.

sorry for my english
q2:

 using (Presentation ppt = new Presentation(file))
            {
                int i = 1;
                foreach (var pptImage in ppt.Images)
                {
                    var len = pptImage.BinaryData.Length;
                    //if (len < size1 || len > size2) continue;

                    var fs = new FileStream($@"dump\{Path.GetFileNameWithoutExtension(file)}_{i++}.png",
                        FileMode.Create);
                    BinaryWriter brWriter =
                        new BinaryWriter(fs);
                    brWriter.Write(pptImage.BinaryData);
                    brWriter.Dispose();
                    fs.Dispose();
                }
            }

The image saved through above code is not the same size as the one I saved in Microsoft Office.

Save ppt hang use this ppt
dump_3.png size is 15,972 bytes but save by ms-office size is 18,108 bytes

@lsl

I have observed your following comments.

I request you to please share the generated output that you have obtained using Aspose.Slides and MS Office for reference. If you are generating the slide thumbnails, then I like to share that by default Aspose.Slides use 72 DPI where as PowerPoint use 96 DPI. That is why you are getting difference in size of thumbnails when generating using Aspose.Slides and PowerPoint.

thanks, i see the dpi Aspose.Slides is 72 , but PowerPoint is between 100-118 (different image has different dpi) ,This is a small problem, mainly to know why.

@lsl,

This is not a problem but implementation standard of API. When slide thumbnails are generated using PowerPoint it has resolution of 960 x 720 with 96 DPI. However, in case of Aspose.Slides, its 720 x 540 for (10’’ x 7.5’’ slide with 72 pixels per inch). You may set the different scaling factor while using Gethumbnail() value to generate any custom dimension you want to obtain. I suggest you to please visit article, generating slide thumbnail with user defined dimensions as well. If you still have issue then as requested earlier, please provide the generated output that you have obtained using Aspose.Slides and MS Office for reference.

I suggest you to please refer to below discussion as well.