Free Support Forum - aspose.com

Aspose Slides error cloning Master slide

Getting this error:
class com.aspose.slides.exceptions.InvalidOperationException: Cannot find any fonts installed on the system.

on:
IMasterSlide iSlide = masters.addClone(sourceMaster);

@ashwin.sundaram,

I have observed the information shared by you and request you to please share the working sample code along with source presentation. We will investigate the issue further on our end to help you out.

Many Thanks,

Mudassir Fayyaz

ForumPresentation.zip (309.4 KB)

Presentation srcPres = new Presentation(template);

  	// Instantiate Presentation class for destination presentation (where
	// slide is to be cloned)

	Presentation destPres = new Presentation();
	
	// Instantiate ISlide from the collection of slides in source
	// presentation along with
	// master slide
	ISlide sourceSlide = srcPres.getSlides().get_Item(4);

	// Clone the desired master slide from the source presentation to the
	// collection of masters in the
	// destination presentation
	IMasterSlideCollection masters = destPres.getMasters();
	IMasterSlide SourceMaster = sourceSlide.getLayoutSlide().getMasterSlide();

	// Clone the desired master slide from the source presentation to the
	// collection of masters in the
	// destination presentation
	IMasterSlide iSlide = masters.addClone(SourceMaster);

	// Clone the desired slide from the source presentation with the desired
	// master to the end of the
	// collection of slides in the destination presentation
	ISlideCollection slds = destPres.getSlides();
	slds.addClone(sourceSlide, iSlide, true);

I think the issue is that while I’m running on the linux server, only certain microsoft office fonts are available, one of which is Arial. All of the fonts on my presentation are in Arial but the generated “Evaluation only. Created with Aspose.Slides…” is in Calibri which isn’t a font in Linux. Is it possible to change what font that text box is?

@ashwin.sundaram,

I have worked with your presentation and have been able to successfully clone the presentation in Windows environment. In your presentation, Calibri and Arial fonts are used. You can copy the Calibri font in your machine and may load that in your application without even installing that. Please visit this documentation link for your kind reference. You can also try replacing the font in your application as well that is not installed before cloning the slides. Please visit this documentation link for your convenience. I hope the shared information will be helpful.

Many Thanks,

Mudassir Fayyaz

I understand that it works fine in a windows environment. I’m running it in a linux environment now and I’m getting the error which I pasted earlier.

@ashwin.sundaram,

I have shared the possible solutions with you in my previous response. The better approach is to copy the used fonts in your machine and load them externally in your application. Otherwise, I have also shared the font replacement mechanism with you as well.

Many Thanks,

Mudassir Fayyaz