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

Free Support Forum - aspose.com

PPTX to PNG - text is appearing as garbage characters in RHEL 7.7

Hi,

We are using Aspose.Slides v19.5 to generate PNG of PPT slides. The text content of PPT is appearing as garbage characters.

OS: Redhat Enterprise Linux 7.7

Following code is used to generate the PNG:

Presentation presentation = new Presentation("Sample PPT.pptx");
SlideCollection slideCollection = (SlideCollection) presentation.getSlides();
Slide slide = (Slide) slideCollection.get_Item(0);
BufferedImage imageEx = slide.getThumbnail(1.0f, 1.0f);
ImageIO.write(imageEx, "png", new File("output.png"));
presentation.dispose();

Please find attached the PPT and its PNG output for your reference:
attachments.zip (27.0 KB)

Can you please look into this issue.

Thanks,
Neha

@Neha_Gautam,

I have observed the issue shared by you and request you to please first try using latest Aspose.Slides for Java 19.11 on your end in your environment. If the issue is still reproduced, please share the output along with Java details as well with us.

Hi, I have tried this with Aspose.Slides v19.11 as well but the issue is still reproducible.
We are using OpenJdk 8.

Thanks,
Neha

@Neha_Gautam,

I have worked with the presentation file shared by you using Aspose.Slides for Java 19.11 on my end using Java 8 in Windows 7. I have not been able to observe the issue. An issue with ID SLIDESJAVA-37994 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

In meanwhile, I also suggest you to please try installing the font used (Calibri Light (Headings) and Calibri) on your end. Secondly, instead of OpenJDK, please also try using Oracle JDK to see if there is still an issue.

Hi,

As mentioned earlier we are using Redhat Enterprise Linux 7.7. The issue is not reproducible on Windows, it is reproducible on RedHat.

As far as missing fonts are concerned, is there a way to figure out which fonts are missing. We have already installed Calibri Light (Headings) and Calibri. We don’t know if any other fonts are missing.

In case of Excel there is a mechanism to figure out the missing fonts as follows:

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setWarningCallback(new ExcelWarningCallback());

class ExcelWarningCallback implements com.aspose.cells.IWarningCallback {
	@Override
	public void warning(com.aspose.cells.WarningInfo info) {
		if (info.getWarningType() == com.aspose.cells.WarningType.FONT_SUBSTITUTION) {
			logger.error(info.getDescription());
		}
	}
}

Is there any similar mechanism for detecting missing fonts in PPT.

Thanks,
Neha

@Neha_Gautam,

You can please consider the following possible option available in Aspose.Slides for Java.

class HandleFontsWarnings implements IWarningCallback
{
StringBuilder warnings = new StringBuilder();

    public int warning(IWarningInfo warning) 
    {
        warnings.append(warning.getDescription() + System.getProperty("line.separator"));
        return ReturnAction.Continue;
    }

    public void saveWarnings(String fileName)
    {
        Writer writer = null;
        try {
            writer = new OutputStreamWriter(new FileOutputStream(fileName), "utf-8");
            writer.write(warnings.toString());
            writer.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException ex) {
                }
            }
        }
    }

}

public void testWarnings(){
String path = "D:/";
LoadOptions lo = new LoadOptions();
HandleFontsWarnings handle = new HandleFontsWarnings();
lo.setWarningCallback(handle);
String fileName = "ModifiedKoreanPpt.pptx";
Presentation pres = new Presentation(path + fileName, lo);

     System.out.println("Converting Ppt to Pdf");
     pres.save(path + "PPTConverted.pdf", SaveFormat.Pdf);
     handle.saveWarnings(path + "out.txt");

}

Thanks for your response.
Can you please let me know if you tried the given issue on Red Hat Linux?

Hi,

This doesn’t seem to be a fonts issue.

We copied the same content from PPT and pasted it in Word and Excel and used Aspose.Words and Aspose.Cells to generate their images. We used the same machine with RedHat Linux and OpenJdk.

In case of Excel and Word, the content is appearing fine but in case of PPT it is rendered as garbage characters.

If it was a fonts issue, the excel and word images would also show garbage characters.

So can you please try this on RedHat Linux with OpenJdk.

Thanks,
Neha

@Neha_Gautam,

Thank you for your feedback. The issue is already under investigation and we will share the good news with you as soon as the issue will be fixed.

Hi,

Thanks for your reply.

Although you are already investigating the issue, I am sharing the PDF and PNG outputs of the PPT slide, it might help you. The PDF output of slide is rendered fine but PNG has garbage characters. So the issue is specifically with PNG.

output.pdf (16.7 KB)
output.png (2.3 KB)

Thanks,
Neha

@Neha_Gautam,

Thank you for sharing the details. We will share the feedback with you once the issue will be fixed.

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