Bug with spacing in aspose.slides for java

Hi,

I ran into a bug with font spacing in Aspose.Slides for Java, when exporting into bitmap images. The bug doesn’t seem to appear when exporting into PDF. I’m using a commercial single-developer OEM license, running this on a Linux machine, with Aspose.slides version 18.8, and java-1.8.0-openjdk.

I’ve attached a sample powerpoint and how the exported first slide comes out in JPG – you can see the word “with” glued to the previous word in the first line.

bug-report.zip (375.4 KB)

I am using the following code to extract the JPG image:

BufferedImage image = slide.getThumbnail(1f, 1f);
OutputStream os = Files.newOutputStream(this.resourcesPath.resolve(fileName));
ImageIO.write(image, "jpg", os);
os.close();

@gojko,

I have worked with source file shared by you using Aspose.Slides for Java 18.9 and unable to observe any issue. I have also shared my generated result with you for your kind reference. Please check attachment. Can you please try to use Aspose.Slides latest version 18.9 on your end share feedback with us if there is still an issue.Slide_1.zip (62.6 KB)

Hi,

I’m getting the following error when trying to use 18.9

Failed to execute goal on project powerpoint-import: Could not resolve dependencies for project com.videopuppet:powerpoint-import:jar:1.0.0: Failed to collect dependencies at com.aspose:aspose-slides:jar:jdk16:18.9: Failed to read artifact descriptor for com.aspose:aspose-slides:jar:jdk16:18.9: Could not transfer artifact com.aspose:aspose-slides:pom:18.9 from/to AsposeJavaAPI (Aspose Repository Browser /java/repo/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Is your SSL cert OK on the artifact repository?

@gojko,

I suggest you to please visit following Github link for POM settings related to Aspose.Slides.

Thanks. I switched from https to http for the repository (as your github example suggested) and I’ve updated to 18.9, but the issue still persists. I am running this on AWS so at first I thought it might have to do with missing fonts, but then I also reproduced it locally on my Mac OS (10.14, 18A391) where the file was created in the first place, so the fonts are definitely there.

What can I do to assist you in troubleshooting this further?

@gojko,

I have tested the presentation file shared by you in MAC using JDK 1.8.0_51 and have not been able to reproduce the issue. Can you please share the complete environment details (Operating System and Java) along with stack trace you are getting on your end to reproduce the issue. The output generated using MAC is also attached for your reference.

Archive.zip (165.8 KB)

Hi,

I’m using MacOS 10.14 (18A391).

$ uname -a
Darwin box.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
$ java -version
java version “1.8.0_77”
Java™ SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot™ 64-Bit Server VM (build 25.77-b03, mixed mode)

I have also isolated the problem with a small project that only exports the image – if you’re getting different results, perhaps I’m trying to create the image differently from you. I attached the sample program. It only has a single source file (src/main/java/pptexample/Example.java). if this is not the correct way to export images, please let me know what it is. To run it, first do

mvn package

then use

java -jar target/ppt-example-0.0.1-SNAPSHOT.jar [license file path] [pptx path] [output image path]

I do not get a stack trace, the program completes successfully, but the word spacing is wrong. I included the ppt file and the output image I get, the word “width” is joined with the word “transitions” at the end of the first line for me. project.zip (376.8 KB)

@gojko,

Thank you for sharing the additional information. I have been able to reproduce the issue on my end and an issue with ID SLIDESJAVA-37384 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.

thanks. The attachment you sent yesterday (Slide_1.zip) has correct spacing, so I assume some other method to export images does not suffer from the same problem. If that’s the case, I’d like to implement that as a workaround while your colleagues are working on fixing the bug. Could you please share the code you used to generate the correct image?

@gojko,

I earlier used following sample code on my end. You may please try this.

    public static void GetSlideThumb(String path, String presFile)
    {

        //String path="C:\\Aspose Data\\Slides\\";
        Presentation presentation = new Presentation(path+presFile);
        ISlide slide;
    
        for (int index = 0; index < presentation.getSlides().size(); index++)
        {
            slide = presentation.getSlides().get_Item(index);

            java.awt.image.BufferedImage image=slide.getThumbnail(1f, 1f);
 //             ImageIO.write(image,"png", new File(path+"Slide_"+index+"_Shape_"+shpCount+".jpg"));
            try 
            {
               // Save the image to disk in PNG format
               ImageIO.write(image, "jpeg", new File(path+"Slides//"+"Slide_"+index+".jpg"));
            } 
            catch (Exception e)
            {
            
            }

        }
    
    }

thanks. You’re also using slide.getThumbnail so that doesn’t really change anything. I guess the function worked for you because you ran it on Windows? In that case, I’ll just wait for the proper fix for MacOS/Linux.

@gojko,

We will share the good news with you as soon as the issue will be fixed and request for your patience.

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