PPT(X) to PDF: Text are missing and only slides background is rendered while using GroupDocs.Conversion 21.10

Hi Team,
We are using GroupDocs.Conversion for 21.10 for converting different formats to pdf in java. We observed that while converting ppt(x) to pdf, the texts are missing and only slides background is rendered with no texts at all.

This works fine on Windows machine however fails on integration environment where we are using Linux system. Could it be the issue of missing fonts in Linux system?

Let us now how we can provide the custom fonts during runtime for ppt(x) to pdf conversion.

Thank you
Rajesh chourasiya

1 Like

@ChourasiyaRajesh

You can set font directory using ConverterSettings class.

ConverterSettings converterSettings = new ConverterSettings();
converterSettings.setFontDirectories(Collections.singletonList(new File("custom_fonts").getAbsoluteFile().getCanonicalPath()));
Converter converter = new Converter("Input.pptx", converterSettings);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("Output.pdf", options);    

Or you can set Presentation file’s load option like this (depending on your requirements).

Hi @Atir_Tahir
Thanks for your reply. We went through the provided option and link to set the load options for Presentation and tried applying the changes. However, the behavior is same and works in Windows nut not in Linux environment. Additionally, we tried to set the custom font through GraphicsEnvironment also. Below is the sample conversion code we are trying and attached snapshot of the converted pdf file (image.jpg, 2nd slide snapshot)

image.jpg (86.2 KB)

The screenshot of original pptx file is also attached for reference (SamplePptxScreenshot.png)
SamplePptxScreenshot.jpg (233.0 KB)

Code snippet:

    try {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Resource resource = new ClassPathResource("font\\DejaVuSans.ttf");
        ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, resource.getInputStream()));
    } catch (FontFormatException | IOException e) {
        e.printStackTrace();
    }
    PresentationLoadOptions loadOptions = new PresentationLoadOptions();
    loadOptions.setDefaultFont("DejaVu Sans");
    final Converter converter = new Converter(new ByteArrayInputStream(sourceBytes), loadOptions);
    final PdfConvertOptions options = new PdfConvertOptions();
    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    converter.convert(outputStream, options);
    return outputStream.toByteArray();

samplepptx.zip (395.4 KB)

Hi @Atir_Tahir we tried below case as well:

  1. Created a sample .docx file and .pptx file (no background) with Arial font and tried to run conversion on Linux integration environment.
    The docx file shows proper conversion as expected however the pptx conversion was totally blank.

Again, both the conversion works well on Windows system only.

Let me know in case of any other alternative ways to resolve this case.

Thank you

@ChourasiyaRajesh

Please share following details and we’ll further look into this issue:

  • Sample application using that issue could be reproduced
  • Linux environment details (e.g. OS version, flavor)
  • Problematic, expected and the converted files

You can also observe the font difference, compare the wrongly converted PDF (on Linux) and the correctly converted PDF (on Windows).
e.g. Open the PDF (in any PDF viewer), go to the properties and check fonts.
Share the font differences with us as well.

Hi @Atir_Tahir

Not sure for the sample application. We are not saving the converted file anywhere, instead the converted byte stream is used to be viewed through pdf-viewer. The environment details are as mentioned below:

  1. Linux Environment:
  • NAME=“Red Hat Enterprise Linux Server”
  • VERSION=“7.9 (Maipo)”
  • ID=“rhel”
  • ID_LIKE=“fedora”
  • VARIANT=“Server”
  • VARIANT_ID=“server”
  • VERSION_ID=“7.9”
  1. Java:
  • OpenJDK 1.8.0_291
  1. Sample pptx file used to convert (samplepptx.zip) and attached screenshot of the converted view of one of the slide (image.jpg) is already attached/uploaded.

Thank you

We need a sample application in order to investigate this issue. Could you please prepare a simple console app just to reproduce the issue.

Hi @Atir_Tahir

Let us know if we can do a screencast in this case. Let us know your feasible time, we will book your calendar.

Thank you

@ChourasiyaRajesh

Please share a sample application. We’ll investigate that at our end. Also note that all free support issues are handled/assisted on this forum.

Hi @Atir_Tahir
We don’t have any sample application available as such as of now and the environment code is all integrated. Creating a sample application with all environment dependencies will take another good time. Since, we are in the approval phase of license purchase, we would like to confirm our decision early.

Please let us know if we can do a screencast and will show the Groupdocs Conversion integration in our application and expected/actual results at runtime. We will try any suggestions provided which could help us to resolve this issue.

Thank you

@ChourasiyaRajesh

Please share a detailed screencast/video that must show the issue. We’ll then further look into this scenario.

Hi @Atir_Tahir
Due to some restrictions, we cannot upload the screencast of application (or any file/zip) from private network. We request you to provide any email id OR support inbox email id where we can send all the details along with the screencast.

Thank you
Rajesh Chourasiya

@ChourasiyaRajesh

We sent you a private message. Please share details in reply.

Hi @Atir_Tahir

Have replied. Please let us know.

Thank you

@ChourasiyaRajesh

Alright.

@ChourasiyaRajesh

Please install missing fonts on the Docker image OS (Red Hat) or copy font files to any folder on image and specify this folder in ConverterSettings:

ConverterSettings converterSettings = new ConverterSettings();
converterSettings.setFontDirectories(Collections.singletonList("/tmp"));
PresentationLoadOptions presentationLoadOptions = new PresentationLoadOptions();
presentationLoadOptions.setDefaultFont("MSGothic");
final Converter converter = new Converter(new ClassPathResource(resourcePath).getInputStream(), presentationLoadOptions, converterSettings);

Let us know if issue persists.

Hello @Atir_Tahir

We tried testing it with below given fragment to use ConverterSettings with PresentationLoadOptions. However we see Memory related issues (out of memory) where the “Converter” is intantiated with PresentationLoadOptions and ConverterSettings.

Below is the fragment of error trace:

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)

Caused by: java.lang.OutOfMemoryError: Java heap space
at com.groupdocs.conversion.internal.c.a.s.internal.oq.p.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.internal.oq.p.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.internal.oq.p.bs(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.FontsLoader.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.FontsLoader.loadExternalFonts(Unknown Source)
at com.groupdocs.conversion.utils.common.FontsHelper.k(Unknown Source)
at com.groupdocs.conversion.utils.common.FontsHelper.i(Unknown Source)
at com.groupdocs.conversion.utils.common.FontsHelper.setFonts(Unknown Source)
at com.groupdocs.conversion.pipeline.a.a(Unknown Source)
at com.groupdocs.conversion.Converter.(Unknown Source)
at com.example.testconversion.TestConversionApplication.convertPptxToPdf(TestConversionApplication.java:42)
at com.example.testconversion.TestConversionApplication.main(TestConversionApplication.java:24)

The java file is attached for your reference and the docker image is also uploaded with tag “with-presentation-load-options”

TestConversionApplication.zip (959 Bytes)

Thank you

@ChourasiyaRajesh

Could you please upload the Docker image again? We can see Java file only.

Hi @Atir_Tahir

Since the image size is large, we cannot upload it. You can pull the image from docker hub.
Have replied you in message.

Thank you
Rajesh Chourasiya

1 Like

@ChourasiyaRajesh

We are further investigating this issue under the same ticket (CONVERSIONJAVA-1552). You’ll be notified in case of any progress.