Free Support Forum - aspose.com

Slide thumbnails not rendering correctly?

Hi,

I’m trying to render slide thumbnails in Python. I’m getting an image, but it’s not rendering correctly. Is is a matter of the scale ?

Here’s the test presentation : https://k4f4w9c2.stackpathcdn.com/wp-content/uploads/01_big_files_kim7/2020_best_ppt/Abstract%20Ink%20Drop%20PowerPoint%20Templates.pptx

Here’s the Aspose rendering of the first slide : Screenshot 2020-10-09 at 10.42.03.jpg (628.0 KB)

Here’s how it should look like : Screenshot 2020-10-09 at 10.42.59.jpg (629.0 KB)

Here’s how I create the thumbnail :

 pres = asposePresentation(file_location)
slides = pres.getSlides()

# CALCULATE THUMBNAILS SCALE
pres_width = pres.getSlideSize().getSize().getWidth()
pres_height = pres.getSlideSize().getSize().getHeight()

desired_x = 1200
desired_y = (desired_x*pres_height)/pres_width

scale_x = (1.0 / pres_width) * desired_x
scale_y = (1.0 / pres_height) * desired_y

image = slide.getThumbnail(scale_x, scale_y)
imageIO.write(image, javaString("jpg"), javaFile(slide_location))

Am I doing something wrong ? I’m surprise because manipulating the slides work on that system witout an issue (if I extract the slide and move it to another presentation, it looks fine).
I’m running on Docker with this Java11-Python3 image : https://hub.docker.com/layers/rappdw/docker-java-python/zulu11.43-python3.7.9/images/sha256-685af18089fe49b726966efa629950689e25e8e432c236809740bdfa2b60dd70?context=explore

Thanks

@albandum

First of all, I suggest you to please try using latest Aspose.Slides for Java 20.9 on your end. Secondly, the issue that you are seeing is owing to missing fonts on machine where you are performing rendering. You need to ensure that the fonts that are used in your presentation are available and installed on machine. Can you please ensure this and share with us if there is still an issue.

Ok, I was afraid that would be the case. Makes sense, but makes my life a lot harder as my customers will be uploading their own presentation and that might break quite a lot of things.

I there a way to detect the fonts present in a presentation with Aspose ? So I can try to download them automatically if I’m missing the font ?

Thanks !
And I’ll upgrade to 20.9.

@albandum

You can try using following Java based code in your environment to verify the fonts used in presentation.

      Presentation pres=new Presentation(path+"JapPres.pptx");
      
      for(int i=0;i<pres.getFontsManager().getFonts().length;i++)
      {
          System.out.println("Font Name: "+pres.getFontsManager().getFonts().toString());
          
      }