We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with aspose.slides when converting ppt fiel to png file

Hi,

I'm trying to convert a ppt file to a png file. Currently the font type seems to be changing, so one letter of the word is on a seperate line. The font class looks as though it holds all fonts from the slide.

This problem seems to happen for a number of slides we have. Please can you investigate / advise.

Code:

Presentation p = new Presentation ("C:\\strat.ppt");

Size imgSize = new Size(2528, 1776);

Aspose.Slides.Slide s = p.GetSlideByPosition(1);

Image img = s.GetThumbnail(imgSize);

string fullFilename = "C:\\strat.png";

img.Save(fullFilename);

Dear Fallman,

I have run your code and generated the image which is attached. I don't see anything wrong. It looks exactly like the original slide in the strat.ppt. In the original slide, one letter of the word is already on the separate line.

Thanks for your prompt reply.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The reason I think the letter 'r' is showing on a new line in the PowerPoint presentation you have is because you do not have the font 'Expert Sans Light’ (this is a custom font we use). The text in this slide is in this font. No doubt it therefore defaults to Arial when you open it (which is a wider font than Expert Sans Light) causing the text to re-format and hence drop onto a second line.

However, I have the font 'Expert Sans Light' loaded on my PC as well as the web server and it doesn't seem to get picked by aspose.slides, although it is shown in the font class. Therefore the font defaults to Arial. Is there a way to get this font picked up by Aspose.slides so the conversion is correct?

We use various Expert Sans fonts so we need these to be reflected in the pgn image in order to reflect the correct formatting.

Dear Andrew,

On my PC, Expert Sans Light is installed. When I open your presentation, the r inside "Stakeholder Pension" is shown on the next line. Further, when I click on this text, the font name Expert Sans Regular is shown rather than Expert Sans Light.

I have attached the screen shot of your presentation as viewed on my PC. Additionally, if I manually select the text and change its font to Expert Sans Light, r still remains on next line.

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

Although it will pick up the font name Expert Sans Regular / Light within PowerPoint, this font will not be used as I suspect the font will not be on the PC you have (look in control panel - fonts). The font therefore actually defaults to Arial (even though in the font field it does say Expert Sans Regular). The Expert Sans Regular and Expert Sans Light are totally different fonts to Arial and can be distinguished visually. Perhaps it may be worth trying to change the font in the presentation you have to Arial and see if it does actually change.

Is there a way for custom fonts to be picked by Aspose.Slides? We have an array of slides which use these custom fonts (400-500).

Thanks Again for your help.

Dear Andrew,

Yes, your observations are right. Can you please attach the screenshot of your original presentation and its thumbnail image taken by Aspose.Slides?

And are these two fonts Expert Sans Regular and Light installed on your PC. Can you please tell me, where can I get these fonts from and install on my PC?

The following code iterates all the text boxes in your presentation and prints their font names on console. To add a new font, see this thread.

<A href="</A> </P> <P>*************************************************</P><FONT size=2> <P></FONT><FONT color=#008080 size=2>Slide</FONT><FONT size=2> srcSld = srcPres.GetSlideByPosition(1);</P> <P></FONT><FONT color=#0000ff size=2>foreach</FONT><FONT size=2> (</FONT><FONT color=#008080 size=2>Shape</FONT><FONT size=2> shp </FONT><FONT color=#0000ff size=2>in</FONT><FONT size=2> srcSld.Shapes)</P> <P>{</P> <P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (shp.TextFrame!=</FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2> )</P> <P>{</P> <P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (shp.IsTextHolder == </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>)</P> <P>{</P> <P></FONT><FONT color=#008080 size=2>TextHolder</FONT><FONT size=2> thld = shp.Placeholder </FONT><FONT color=#0000ff size=2>as</FONT><FONT size=2> </FONT><FONT color=#008080 size=2>TextHolder</FONT><FONT size=2>;</P> <P></FONT><FONT color=#008080 size=2>Portion</FONT><FONT size=2> port = thld.Paragraphs[0].Portions[0];</P> <P></FONT><FONT color=#008080 size=2>FontEntity</FONT><FONT size=2> fnt = srcPres.Fonts[port.FontIndex];</P> <P></FONT><FONT color=#008080 size=2>Console</FONT><FONT size=2>.WriteLine(fnt.FontName);</P> <P>}</P> <P></FONT><FONT color=#0000ff size=2>else</P></FONT><FONT size=2> <P>{</P> <P></FONT><FONT color=#008080 size=2>TextFrame</FONT><FONT size=2> tf = shp.TextFrame;</P> <P></FONT><FONT color=#008080 size=2>Portion</FONT><FONT size=2> port = tf.Paragraphs[0].Portions[0];</P> <P></FONT><FONT color=#008080 size=2>FontEntity</FONT><FONT size=2> fnt = srcPres.Fonts[port.FontIndex];</P> <P></FONT><FONT color=#008080 size=2>Console</FONT><FONT size=2>.WriteLine(fnt.FontName); </P> <P>}</FONT><FONT color=#008000 size=2>//inner if</P></FONT><FONT size=2> <P>}</FONT><FONT color=#008000 size=2>//outer if</P></FONT><FONT size=2> <P>}</FONT><FONT color=#008000 size=2>//foreach</P></FONT></FONT>

Please find attched a zip file cotaining the fonts, screenshot of the presentation and the png image file. You will need to add the fonts by going to Control Panel -> Fonts ->File-> Install New Font

Thanks

Andrew

I have reported this problem for a fix.

How do I embed fonts using the PresentationEx object? It has no “Fonts” collection.

How do I access presentation fonts using the PresentationEx object? It has no “Fonts” collection.

Hi Daniel,


Please proceed to this link for your kind reference. Please share, if I may help you further in this regard.

Many Thanks,