Thumbnail generation trow an error

This is the real code we use to generate the Thumbnail fo each slide :

public static BufferedImage getBufferedImage2(double width, SlideEx slide) {


Dimension2D size = slide.getPresentation().getSlideSize().getSize();


double presentationScaling = size.getWidth() / size.getHeight();

double scaleX = (1f / size.getWidth()) * width;
double scaleY = ((1f / size.getHeight()) * width) / presentationScaling;


Dimension dimension = new Dimension();
dimension.setSize(scaleX,scaleY);


BufferedImage thumbnail = slide.getThumbnail(dimension);
return thumbnail;
}



Simple test


private void test()
{
PresentationEx pres = null;
try {
pres = new PresentationEx(new FileInputStream("/Test/test.pptx"));
} catch (FileNotFoundException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}

SlideEx slide = pres.getSlides().get_Item(0);
Dimension2D size = slide.getPresentation().getSlideSize().getSize();
Dimension dimension = new Dimension();
dimension.setSize(1.7777,1.7777);


BufferedImage thumbnail = slide.getThumbnail(dimension);

}


This is the error :

java.lang.IllegalStateException: Cannot find resource '/Aspose/Resources/GenBasR.ttf'.

Can you please help with it ? Withe the version 2.9 was working fine .

Best regards

Angelo Trozzo.




Hi Angelo,


I have observed the sample code shared and there does not seems to be any issue in the code. Please share the sample presentation with us so that I may investigate the issue further on my end to help you out. Please also try using Aspose.Slides for .NET 7.3.1 on your end first.

Many Thanks,

Hi,


thanks for the fast reply, I have attached one of the presentation that fails. However we cannot use .NET, our solution is based on Java.

Best regards

Angelo Trozzo.

Hi Angelo,


I have used the same code shared by you by adding a small modification to generate the slide thumbnails and saving them to disk. I have used Aspose.Slides for Java 7.2.0 on my end in Windows 7 environment. I have not been able to reproduce the issue. Can you please share the environment and JDK details on your end. For your kind reference, I have attached the generated thumbnails.


public static void testImage()
{
String path = “C:\Users\Mudassir\Downloads\7.2.0 Release\”;
PresentationEx pres = null;
try
{
pres = new PresentationEx(new FileInputStream(path + “Testing.pptx”));
}
catch (FileNotFoundException e)
{
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}

for (int i = 0; i < pres.getSlides().getCount(); i++)
{
SlideEx slide = pres.getSlides().get_Item(i);
Dimension2D size = slide.getPresentation().getSlideSize().getSize();
Dimension dimension = new Dimension();
dimension.setSize(1.7777, 1.7777);


BufferedImage thumbnail = slide.getThumbnail(dimension);
try {
ImageIO.write(thumbnail, “jpeg”,new File(path + “Slides/Slide_”+Integer.toString(i+1)+".jpeg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
Many Thanks,

Hi,


I am using Mac Book
OSX version 10.8.3
Java version : 1.6.0.37

However I will re test it on with your modification and on another machine.
Thanks for your help,

Best regards

Angelo.

Hi Angelo,


Thanks for sharing the information. I also like to add that the exception message shared seems that you have some missing font on your end in your machine. Please ensure that you have fonts used in your presentation also installed on your machine. Please share your results with us once you test on another machine and share your feedback. If there is still an issue then please share with us and I will add the ticket for it in our issue tracking system.

Many Thanks,