I’m having a bit of an odd Aspose issue that I was hoping someone could help me with. I’m using Aspose slides to convert ppt slides into PNG and SVG images, but for some reason the api is failing to properly convert some Chinese characters. Rather than simply importing the characters as-is, the Aspose library is intermittently bolding random characters in sentences. It’s not like the whole sentence is bold, it’s just random characters here and there. Here is a sample of the issue:
Here is a code snippet from our conversion code. Let me know if you need anything else:
LoadOptions lo = new LoadOptions(LoadFormat.Auto);
lo.setDefaultRegularFont(“Arial Unicode MS”);
lo.setDefaultAsianFont(“Arial Unicode MS”);
lo.setDefaultSymbolFont(“Arial Unicode MS”);
Presentation pres = new Presentation(file.getInputStream());
// Getting last slide index
int lastSlidePosition = pres.getSlides().size();
ISlide slide = null;
JPEGTranscoder t = new JPEGTranscoder();
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
// Iterating through every presentation slide and generating SVG image
List newSlides = new ArrayList();
for (int i = 0; i < lastSlidePosition; i++) {
logger.debug("Generating slide: " +i);
ImportedSlide importedSlide = new ImportedSlide();
// Accessing Slides
slide = pres.getSlides().get_Item(i);
BufferedImage buffImage = slide.getThumbnail((float)1.5, (float)1.5);
String b64 = imgToBase64String(buffImage, "png");
@ggrieco,
Thank you for the code snippet. A presentation sample is very important for the issue investigation. The presentation files (and any other) can be uploaded using the same button “Upload” that you used for attaching PNG files.
@ggrieco,
Thank you for the presentation sample. I have reproduced the problem and got the same results. I have logged the issue in our tracking system with ID SLIDESJAVA-38441. Our development team will investigate the issue. You will be notified when it is fixed.
Our feature doesn’t only support Chinese characters though. We wouldn’t want to change the font set across the board. Is there any way to detect Chinese characters in the ppt and then change the font? Or is there any way to fix the Arial bug so we don’t need to manipulate fonts in the Java?
@ggrieco,
To my regret, the issue will take a long time to resolve. You can try the fallback mechanism for some character ranges so that you don’t replace the fonts entirely. More details: Set Font FallBack. If it does not help you, the development team will continue to work on this issue.
We tried running a sample through the updated library and it still isn’t working for us. We seem to have found one potential cause of the issue. It looks like SimHei font is not being recognized by the Aspose library and that is causing the characters to render improperly. When we changed to font to other font families it was interpreted correctly.
@ggrieco,
To my regret, the notification has been sent automatically because the issue is closed (without a solution). Could you share both presentations (with the problem and without one), please?