Background Graphics Is Hidden by Default when Applying Master Slide to Another Presentation

Hi,

I was applying a master slide from a theme PPTX to a target presentation. The chart colors and background colors are all fine when applying but the background graphics is hidden from view. I wasn’t able to find an API to unhide it but I can do it manually in Powerpoint. Could you help me with this?

Code to convert and sample PPTX files are attached:

java.zip (8.1 MB)

Expected: Screenshot 2023-01-10 at 2.19.14 PM.jpg (117.3 KB)
Actual: Screenshot 2023-01-10 at 2.18.58 PM.jpg (103.1 KB)

Aspose.Slides version: 22.11
System: macOS

@srijal,
Thank you for contacting support. I am working on the issue you described and will get back to you soon.

@srijal,
I’ve reproduced the problem with missing background graphics when cloning the master slide to another presentation and added a ticket with ID SLIDESJAVA-39084 to our issue-tracking system. We apologize for any inconvenience. Our development team will investigate the case. You will be notified when a new release of Aspose.Slides with the update is published.

Please also share the following additional information:

  • macOS version on which the problem occurred
  • JDK version in your app

@srijal,
Our developers have carefully studied the problem you described and they found the following code lines:

try (var document = new Document("saved.pdf")) {
    document.save("saved.pptx", SaveFormat.Pptx);

The Document object (Aspose.PDF) creates a new presentation from the PDF. Please look at the background properties of the presentation created by Aspose.PDF: backgroud.png (56.0 KB). We can easily find that the “hide background graphics” property is already set to true, therefore, all subsequent operations already take this property into account. This leads to the conclusion that the problem occurs when Aspose.PDF converts PDF to PPTX.

From the side of Aspose.Slides, we can suggest to use setShowMasterShapes and getShowMasterShapes methods:

for (ISlide slide : pres.getSlides()) {
    slide.getLayoutSlide().setMasterSlide(slideMaster);
    if (sourceSlide.getShowMasterShapes())
        slide.setShowMasterShapes(sourceSlide.getShowMasterShapes());
}

Thanks for the solution. It seems to work well for the Theme.pptx file. However, I am facing an exception converting for another theme. Please use the attached Theme2.pptx file with the above code to reproduce.

Exception

Exception in thread "main" class com.aspose.slides.exceptions.KeyNotFoundException: The given key was not present in the dictionary. com.aspose.slides.Collections.Generic.SortedList$ThrowHelper.throwKeyNotFoundException(Unknown Source) com.aspose.slides.Collections.Generic.SortedList.get_Item(Unknown Source) com.aspose.slides.internal.o0.break.<init>(Unknown Source) com.aspose.slides.internal.o0.long.goto(Unknown Source) com.aspose.slides.internal.o0.long.case(Unknown Source) com.aspose.slides.internal.o0.extends.do(Unknown Source) com.aspose.slides.sd.do(Unknown Source) com.aspose.slides.sd.do(Unknown Source) com.aspose.slides.sd.do(Unknown Source) com.aspose.slides.sd.do(Unknown Source) com.aspose.slides.rr.do(Unknown Source) com.aspose.slides.av2.do(Unknown Source) com.aspose.slides.rr.do(Unknown Source) com.aspose.slides.ol.do(Unknown Source) com.aspose.slides.sj.do(Unknown Source) com.aspose.slides.ax1.static(Unknown Source) com.aspose.slides.z2.do(Unknown Source) com.aspose.slides.axu.do(Unknown Source) com.aspose.slides.axu.<init>(Unknown Source) com.aspose.slides.axl.do(Unknown Source) com.aspose.slides.axm.do(Unknown Source) com.aspose.slides.axm.do(Unknown Source) com.aspose.slides.axm.do(Unknown Source) com.aspose.slides.axm.if(Unknown Source) com.aspose.slides.al.do(Unknown Source) com.aspose.slides.u6.do(Unknown Source) com.aspose.slides.u6.do(Unknown Source) com.aspose.slides.ce.do(Unknown Source) com.aspose.slides.z5.do(Unknown Source) com.aspose.slides.ase.do(Unknown Source) com.aspose.slides.amj.do(Unknown Source) com.aspose.slides.amj.do(Unknown Source) com.aspose.slides.al9.do(Unknown Source) com.aspose.slides.MasterSlideCollection.do(Unknown Source) com.aspose.slides.MasterSlideCollection.addClone(Unknown Source) App.convertToPptxWithTheme(App.java:116) App.main(App.java:13) at com.aspose.slides.Collections.Generic.SortedList$ThrowHelper.throwKeyNotFoundException(Unknown Source) at com.aspose.slides.Collections.Generic.SortedList.get_Item(Unknown Source) at com.aspose.slides.internal.o0.break.<init>(Unknown Source) at com.aspose.slides.internal.o0.long.goto(Unknown Source) at com.aspose.slides.internal.o0.long.case(Unknown Source) at com.aspose.slides.internal.o0.extends.do(Unknown Source) at com.aspose.slides.sd.do(Unknown Source) at com.aspose.slides.sd.do(Unknown Source) at com.aspose.slides.sd.do(Unknown Source) at com.aspose.slides.sd.do(Unknown Source) at com.aspose.slides.rr.do(Unknown Source) at com.aspose.slides.av2.do(Unknown Source) at com.aspose.slides.rr.do(Unknown Source) at com.aspose.slides.ol.do(Unknown Source) at com.aspose.slides.sj.do(Unknown Source) at com.aspose.slides.ax1.static(Unknown Source) at com.aspose.slides.z2.do(Unknown Source) at com.aspose.slides.axu.do(Unknown Source) at com.aspose.slides.axu.<init>(Unknown Source) at com.aspose.slides.axl.do(Unknown Source) at com.aspose.slides.axm.do(Unknown Source) at com.aspose.slides.axm.do(Unknown Source) at com.aspose.slides.axm.do(Unknown Source) at com.aspose.slides.axm.if(Unknown Source) at com.aspose.slides.al.do(Unknown Source) at com.aspose.slides.u6.do(Unknown Source) at com.aspose.slides.u6.do(Unknown Source) at com.aspose.slides.ce.do(Unknown Source) at com.aspose.slides.z5.do(Unknown Source) at com.aspose.slides.ase.do(Unknown Source) at com.aspose.slides.amj.do(Unknown Source) at com.aspose.slides.amj.do(Unknown Source) at com.aspose.slides.al9.do(Unknown Source) at com.aspose.slides.MasterSlideCollection.do(Unknown Source) at com.aspose.slides.MasterSlideCollection.addClone(Unknown Source) at App.convertToPptxWithTheme(App.java:116) at App.main(App.java:13)

java.zip (8.1 MB)

@srijal,
Unfortunately, I was unable to reproduce the exception. Could you please run the code you provided, check your results again and confirm?