Exception: StackOverflowError on using large fonts with small chart (Java)

Hello,

We noticed that when a small chart uses disproportionally large fonts a StackOverflowError occurs.

This behavior can be seen in the latest Aspose Slides for Java version 20.3, the attached "Chart_OverflowErr.pptx” file and the following Java code:

final String pptxFile = [PATH] + "Chart_OverflowErr.pptx";
final String pdfFile = pptxFile.replace(".pptx", ".pdf");
Files.deleteIfExists(Paths.get(pdfFile));

Presentation ppt = new Presentation(pptxFile);

ppt.save(pdfFile, SaveFormat.Pdf);
System.out.println("Saved PDF File: " + pdfFile);

Running the above code should produce a StackOverflowError with the following (partial) stack:

Exception in thread "main" java.lang.StackOverflowError
  at com.aspose.slides.internal.ey.throws.do(Unknown Source)
  at com.aspose.slides.c5.do(Unknown Source)
  at com.aspose.slides.an9.do(Unknown Source)
  at com.aspose.slides.an9.do(Unknown Source)
  at com.aspose.slides.an9.do(Unknown Source)
  at com.aspose.slides.an9.do(Unknown Source)
  at com.aspose.slides.an9.<init>(Unknown Source)
  at com.aspose.slides.TextFrame.do(Unknown Source)
  at com.aspose.slides.TextFrame.do(Unknown Source)
  at com.aspose.slides.TextFrame.else(Unknown Source)
  at com.aspose.slides.anv.do(Unknown Source)
  at com.aspose.slides.ais.new(Unknown Source)
  at com.aspose.slides.c7.byte(Unknown Source)
  at com.aspose.slides.q0.catch(Unknown Source)
  at com.aspose.slides.q0.catch(Unknown Source)
  at com.aspose.slides.q0.catch(Unknown Source)
  . . . [remaining 1008 stack items omitted]

Key Observations:

  • Width & Font Size: The culprit seems to be related to the chart’s width vis-à-vis the font sizes of its Legend and vertical axis labels.
    In the attached PPTX:
    • The chart’s width is small at 2.08 inches
    • The font size of the chart’s Legend and vertical axis labels is disproportionately large at 18 pts.
  • Workarounds: to circumvent the StackOverflowError:
    • Increase the chart’s width to as little as 2.11". - or -
    • Keep the current chart width (2.08"), but reduce the font size of the Legend and Vertical Axis labels to 12 pts.
  • Fixed Presentation: If you run the code, but using the attached Chart_OverflowErr_fixed.pptx file, the StackOverflowError does not occur. This Presentation is nearly identical to Chart_OverflowErr.pptx, but the font sizes used in the chart are reduced to 12 pts (from 18 pts).

Environment Details:

  • Aspose Slides for Java 20.3
  • Java version 1.8.0_211
  • Windows 10 OS (but also reproducible under Linux).

File description in the Chart_OverflowError.zip (102.0 KB) attachment:

  • Chart_OverflowErr.pptx: Presentation to be converted to PDF.
  • Chart_OverflowErr_fixed.pptx: Identical to Chart_OverflowErr.pptx but the font sizes in the chart are reduced.
  • Chart_OverflowErr_fixed.pdf: PDF file generated in our environment when Chart_OverflowErr_fixed.pptx is used.

Thank you!

@oraspose,

I have observed the issue shared by you and have created an issue with ID SLIDESJAVA-38078 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.

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