Free Support Forum - aspose.com

Weird Character spacing and Missing bullet after converting to svg format

Hi there


I am using Aspose Slides 16.6.0 for converting PowerPoint files to svg files.
There are 2 problems.
1. The bullet icons are not shown correctly.
2. Some texts’ are too close or too far. It may get a little bit harder to read.

Here is my code for test:
Presentation pre = new Presentation(“sample1_pusheen.pptx”);
String dirName = UUID.randomUUID().toString();
File file = new File("" + dirName);
file.mkdirs();

for (int i = 0; i < pre.getSlides().size(); i++) {
pre.getSlides().get_Item(i).writeAsSvg(
new FileOutputStream("" + dirName + “/” + (i + 1) + “.svg”));
}

Please the comparison, origin file and result svg file, thanks :slight_smile:



Hi Craig,

I have worked with presentation and source code shared by you using Aspose.Slides for JAVA 16.6.0 in Windows 10 with Java 8 environment and unable to reproduce the issue. I have also attached generated output file for your reference. Please share feedback with us in case there is an issue.

Best Regard,
Hi Craig,

I have already shared the correct output that has been generated on my end with you. There seems to be an issue with your fonts installation and missing fonts on your end. I suggest you please make sure that fonts you used in your presentation are available in your machine.

Best Regard,

Hi

Thanks your testing.

I am sorry that I forgot to mention that I run this code in Linux environment.

I have uploaded the same PowerPoint file with font embedded, and problems still happens.

PowerPoint files that we have to deal may come from all around the world, and it would be impossible for us to collect all fonts in the world.

Hi Craig,


I have worked with new presentation as well and have successfully created SVG files for that. I have attached them for your reference as well.

The main issue is missing fonts on your end. For your earlier presentation which use Microsoft Jhenghei in it. If you install or even load the font externally in application by simply copying that in some directory and referring to that directory in your application to load fonts externally before loading presentation, rendering issue will get resolved on your end. If you are unable to install all fonts for a reason that you receive presentations from various sources around the world, then loading them externally is a viable option on your end. It is unfortunately not possible that if a font that is used in presentation is unavailable then rendering may go fine. I hope the shared information will be helpful.

Best Regards,

Hi Adnan Ahmad


Thanks for your advise.
Is there any way to scan all of text in a PowerPoint file, and replace its font to another font installed if the font is not installed?

Hi Craig,


I like to mention that Aspose.Slides offers FontsManger that can help you in replacing fonts explicitly inside presentation as well as rule based replacement. Please visit this documentation link for your further reference.

Best Regards,

Hi

Thanks for your information!

The problem that character covered by each other is resolved with the following code and the font in attachment in Linux environment.


String[] _fontDir = new String[] { “fontsForTest” };
FontsLoader.loadExternalFonts(_fontDir);

Presentation pre = new Presentation(“sample1_pusheen.pptx”);

FontSubstRuleCollection fontRuleColl = new FontSubstRuleCollection();
for(final IFontData fontData :pre.getFontsManager().getFonts()){
fontRuleColl.add(new IFontSubstRule() {
@Override
public IFontData getSourceFont() {
return fontData;
}
@Override
public int getReplaceFontCondition() {
return FontSubstCondition.WhenInaccessible;
}
@Override
public IFontData getDestFont() {
return new FontData(“HanWangHeiLight”);
}
});
}
pre.getFontsManager().replaceFont(fontRuleColl);

String dirName = UUID.randomUUID().toString();
File file = new File("" + dirName);
file.mkdirs();

for (int i = 0; i < pre.getSlides().size(); i++) {

pre.getSlides().get_Item(i)
.writeAsSvg(new FileOutputStream("" + dirName + “/” + (i + 1) + “.svg”));

}


However, there is still some problems.
1. The Bullet icons can not show correctly.
2. I noticed that if you remove or adjust attribute “textLength” in the previous svg files, the text covering problem would be fixed.
Is it possible we can do some fix when rendering svg files, so that the “textLength” attributes can be produced correctly? (Without any font replacing).



Hi Craig,

I have worked with the presentation file using Aspose.Slides for Java 16.6.0 and have been able to reproduce the bullets point issue. A ticket with ID SLIDESJAVA-35577 has been created in our issue tracking system to investigate and resolve the issue. This thread has been associated with the ticket so that we may share the notification with you once issue will be fixed.

As far as your second point related to making changes or fixing in existing presentation slide text before rendering slide to SVG. I like to mention that you can access the desired text inside particular slide shape and make necessary changes. Please visit this documentation section for your further reference.

We are sorry for your inconvenience,
Hi Craig,

Our product team has investigated the issue on their end. Actually, the problem is reproduced on Linux only when Wingdings font is missing. Can you please use FontsLoader for loading Wingdings font and then convert the presentation to images. I hope this will be helpful.

Best Regards,

Hi Adnan Ahmad


Our application(some kind of conversion like above) will be running for commercial use.

Before we try to loading Windings in Linux environment, I want to confirm:
Is it legal to copy it from Windows to Linux for commercial use?

Hi Craig,

I have observed your comments. I like to share that we have suggested you to use Wingding font. You can get this from any available source. It’s up to you that from which source you avail the missing font.

Many Thanks,

Hi Mudassir


Thanks for your information.

Wingdings font seems to come from Windows OS.
In Linux we can install mscorefont to get this font installed in Linux OS.

We will keep investigate that it is legal or not to convert files on Linux with the font from Microsoft while the file’s source is unknown.
If it doesn’t work, we might be going to find the alternative to replace Wingdings.

Thanks for your help again :slight_smile:

Update:
According to our talking to Microsoft’s customer service, the Wingdings from Windows can not be used in other OS including Linux unless we apply a copyright request.

Hi Craig,

You are welcome. As shared by you that you need to get copyright for the Wingdings. Once you will do that, you will find the results as desired in your application.

Many Thanks,

The issues you have found earlier (filed as SLIDESJAVA-35577) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Mudassir


Is it possible to edit or replace bullets with unicode icons?
Like: ◆ or

So that we can replace it without worrying about the missing font


Craig

Hi Craig,


I have observed your comments. You should give try to this option and share feedback with us.

Best Regards,

Hi Adnan.Ahmad


Yes. Is there a way provided to edit or replace bullets with Aspose APIs?

Craig

Hi Craig,


I have observed your comments. I have shared a piece of code in a text file with you. I hope you will find it helpful. Please see attachments.

Best Regards,