Free Support Forum - aspose.com

Embedded fonts and Slide.getThumbnail - java

Hi,

I have problems with Korean characters during creating Thumbnails for 33koreaBSB.ppt.

For created images I have squares instead of Korean characters in every text fragment that uses Gulim font and normal Korean characters for text fragments that use GulimChe.

GulimChe font is installed on my Windwos XP, but Gulin font is not.


So question is:

Is it possible to use getThumbnail method to create images from any presentation that contains Korean content? Actually it’s required to configure environment ones (install needed fonts) and than convert presentation from different sources.

Thanking you in anticipation.

Ghena

Fragment of java code:

Dimension awtDimention=new Dimension(640 , 480);

Slides slds = srcPres.getSlides();

Slide sld = srcPres.getSlideByPosition(1);

BufferedImage image=sld.getThumbnail(awtDimention);

Presentation:

http://www.33korea.net/33koreaBSB.ppt

Presentation.getFonts() retirned:

xtractor - Font: charset=-127; font family=48; index of a font=0; font name=??; font pitch=2; font quality=4;

0 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=0; font family=32; index of a font=1; font name=Arial; font pitch=2; font quality=4;

0 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=2; font name=HY??M; font pitch=2; font quality=6;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=0; font family=16; index of a font=3; font name=Times New Roman; font pitch=2; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=2; font family=0; index of a font=4; font name=Wingdings; font pitch=2; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=5; font name=HY????M; font pitch=2; font quality=6;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=48; index of a font=6; font name=???; font pitch=1; font quality=6;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=7; font name=????; font pitch=2; font quality=6;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=8; font name=Baekmuk Batang; font pitch=2; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=0; font family=48; index of a font=9; font name=Courier New; font pitch=1; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=0; index of a font=10; font name=Baekmuk Gulim; font pitch=2; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=11; font name=Baekmuk Headline; font pitch=2; font quality=4;

16 [main] DEBUG com.mpi.converter.aspose.AsposTextExtractor - Font: charset=-127; font family=16; index of a font=12; font name=Baekmuk Dotum; font pitch=2; font quality=4;

Dear Ghena,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

You will need correct font installed on your computer to make it work correctly.

Shakeel, thank you for your reply.

But looks like info “how to use your advice” is missed.

“You will need correct font installed on your computer” – please provide me with idea which font is correct and which is not in two contexts:

First: for http://www.33korea.net/33koreaBSB.ppt

Second: let’s consider Use Case when our designer constantly provide me with new presentations, and I need to create web App to convert them to images. Have we constantly synchronize fonts on server with designer’s PC to have all fonts (that could be potentially used in presentations) installed.

Thanking you in anticipation

Gena

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Interesting,

Tonic can convert the slide to Image on the same PC inside of the same environment with the same set of the installed fonts. Image is attached.

But look like it used different “similar” Korean fonts to render image.

Gena

Dear Gena,

Yes, definitely, you would need a font used by the your client in order to get correct images. But if font is not an issue, then you can use Arial Unicode MS font for all of your presentations. For example, please see the images taken by me by the following code. I will attach the images shortly, but you can regenerate them by running the code.

-----------------------------------------------------------------------------------------------------------------------

Presentation srcPres = new Presentation(new FileInputStream("d:\\dwnlds\\33koreaBSB.ppt"));

//Change all of your fonts to Arial Unicode MS.

int fntsCount = srcPres.getFonts().size();

for (int fntIdx = 0; fntIdx < fntsCount; fntIdx++)

{

FontEntity fntEnt = srcPres.getFonts().get(fntIdx);

fntEnt.setFontName("Arial Unicode MS");

}

Slides slds = srcPres.getSlides();

int lastSlidePos = slds.getLastSlidePosition();

for (int i = 1; i <= lastSlidePos; i++)

{

Slide sld = srcPres.getSlideByPosition(i);

BufferedImage image = sld.getThumbnail(1.0F, 1.0F);

ImageIO.write(image, "jpg", new File("c:\\images\\aslide" + i + ".jpg"));

}

-----------------------------------------------------------------------------------------------------------------------

Shakeel, thank you for your help.

Your solution really works.

Best regards
Gena