Hi Team,
While converting PPT into PDF we are using Presentation class Object to load ppt file in Java code.
import com.aspose.slides.Presentation;
Presentation presentation = new Presentation("sample1.pptx");
We have encountered an issue where if PPT file contain empty user comment then code is throwing below error:
Caused by:
com.aspose.slides.PptxReadException: Specified argument was out of the range of valid values.
Parameter name: Parameter name: index
at com.aspose.slides.irz.xl(Unknown Source)
at com.aspose.slides.Presentation.u4(Unknown Source)
at com.aspose.slides.Presentation.xl(Unknown Source)
at com.aspose.slides.Presentation.<init>(Unknown Source)
at com.aspose.slides.Presentation.<init>(Unknown Source)
at com.aspose.slides.Presentation.<init>(Unknown Source)
at
com.demo.ConverterWithPDFOptions.convert(ConverterWithPDFOptions.java:37)
... 23 common frames omitted
Caused by:
com.aspose.slides.exceptions.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Parameter name: index
at com.aspose.slides.Collections.Generic.List.get_Item(Unknown Source)
at com.aspose.slides.eum.xl(Unknown Source)
at com.aspose.slides.fji.f9(Unknown Source)
at com.aspose.slides.fji.xl(Unknown Source)
at com.aspose.slides.xz5.xl(Unknown Source)
at com.aspose.slides.irz.sr(Unknown Source)
... 30 common frames omitted
Here attaching affected ppt file. on slide 37 there is empty comment which is causing the issue as per our analysis.
Empty comment slide 37.png (255.9 KB)
sample.zip (2.1 MB)
@forasposeissues
Summary
The presentation fails to load because Aspose.Slides for Java throws an ArgumentOutOfRangeException when it encounters a comment that has no text. The empty comment causes the SDK to try to access a collection element that does not exist.
Why it happens
In the supplied PPTX the comment on slide 37 contains an empty <a:txBody> element. In some versions of Aspose.Slides the loader assumes that a comment always has at least one text run and directly accesses the first item in the collection. When the collection is actually empty, the SDK raises the out‑of‑range error you see.
What to do next
- Check the Aspose.Slides for Java version you are using. Older releases are more likely to contain this bug. You can print the version at runtime:
System.out.println(com.aspose.slides.VersionInfo.getVersion());
- Upgrade to the latest Aspose.Slides for Java if you are on an older build. Newer versions have improved validation of comment data and generally do not crash on empty comments.
- If you cannot upgrade immediately, load the file without parsing comments:
import com.aspose.slides.*;
LoadOptions loadOptions = new LoadOptions();
loadOptions.setLoadComments(false); // skip comment parsing
Presentation pres = new Presentation("sample1.pptx", loadOptions);
pres.save("output.pdf", SaveFormat.Pdf);
Skipping comment loading avoids the code path that fails.
4. Work‑around: remove the empty comment
- Open the PPTX in PowerPoint and delete the empty comment, or
- Unzip the PPTX, edit
ppt/comments/comments1.xml to delete the <p:cm> element whose <a:txBody> is empty, then zip the files back.
- Verify the fix
- Run the conversion again after applying one of the steps above. The process should complete without the
PptxReadException / ArgumentOutOfRangeException.
If the problem persists after trying these steps, please provide the exact Aspose.Slides for Java version you are using and, if possible, a minimal reproducible PPTX file. This information will help Aspose support investigate the issue further.
Note: The above recommendations are based on typical handling of empty comments in Aspose.Slides and the error stack you posted. The specific fix (e.g., version where the bug was resolved) is not confirmed by the supplied evidence, so you may need to confirm with Aspose’s release notes or support.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
@forasposeissues,
Thank you for contacting free support. I need some time to investigate the issue. I will get back to you as soon as possible.
@forasposeissues,
I was unable to reproduce the exception using Aspose.Slides for Java 25.10. We recommend you use the latest version of Aspose.Slides for Java.