Browse our Products

Aspose.Slides for Java 17.9 Release Notes

KeySummaryCategory
SLIDESNET-38899Option for saving CSS and images separately when exporting as HTMLFeature
SLIDESNET-39196Render notes when saving as HTMLFeature
SLIDESNET-39113Saving into HTML with preserving original fontsFeature
SLIDESNET-39090The possibility to specify fonts to process a single presentationEnhancement
SLIDESJAVA-36583Tomcat startup becomes slow using Aspose.SlidesBug
SLIDESJAVA-36600Reason of exception while converting ODP to PDFBug
SLIDESJAVA-33852Word wrapping is different for text in generated PDFBug
SLIDESJAVA-33868Text wrapping for bar chart category axis is disturbed in generated PDFBug
SLIDESJAVA-36427PPT to JPEG Issue.Bug
SLIDESJAVA-36552Exporting PowerPoint files to PDF is x2 slower at leastBug
SLIDESJAVA-36422PowerPoint 15 for Mac shows a warning that there are embedded fontsBug
SLIDESJAVA-36594When presentation is converted to PDF, the font in output PDF gets bigger.Bug
SLIDESJAVA-35235Missing background in generated thumbnailBug
SLIDESJAVA-36209Font size changesBug
SLIDESJAVA-36213Unexpected shadow effect shows upBug
SLIDESJAVA-36431PptxRead exception on loading presentationBug
SLIDESJAVA-36480Animation dimming effect missing after saving presentationBug
SLIDESJAVA-36483Compliance property not working fineBug
SLIDESJAVA-36544Timed based animation on bullet effects are lost on cloning slidesBug
SLIDESJAVA-36548Converting PPT to PDF worked in 17.4 but never completes in 17.7Bug

Public API Changes

Added possibility to specify fonts used with a presentation in the Aspose.Slides for Java

A new getDocumentLevelFontSources/setDocumentLevelFontSources methods have been added to ILoadOptions interface. It allows to specify external fonts that are used with the presentation.

getDocumentLevelFontSources method returns instance of IFontSources class that has the following methods:

  • getFontFolders/setFontFolders - get/set folders that are recursively searched for font files.
  • getMemoryFonts/getMemoryFonts - get/set collection of fonts represented as byte arrays.
byte[] memoryFont1 = ReadAllBytesFromFile("customfonts\CustomFont1.ttf");
byte[] memoryFont2 = ReadAllBytesFromFile("customfonts\CustomFont2.ttf");

ILoadOptions loadOptions = new LoadOptions();
loadOptions.getDocumentLevelFontSources().setFontFolders(new String[] { "assets\fonts", "global\fonts" });
loadOptions.getDocumentLevelFontSources().setMemoryFonts(new byte[][] { memoryFont1, memoryFont2 });
IPresentation presentation = CreatePresentation("MyPresentation.pptx", loadOptions);
try{
    //work with the presentation
    //CustomFont1, CustomFont2 as well as fonts from assets\fonts & global\fonts folders and their subfolders are available to the presentation
}finally {
    presentation.dispose();
}

The fonts that are passed to FontSources are available to the presentation throughout its lifetime and are not available outside the presentation. Consider the following example:

final String[] fontFolders1 = new String[] { "assets\fonts" };
final String[] fontFolders2 = new String[] { "global\fonts" };

final byte[] memoryFont1 = ReadAllBytesFromFile("customfonts\CustomFont1.ttf");
final byte[] memoryFont2 = ReadAllBytesFromFile("customfonts\CustomFont2.ttf");

final IFontSources fontSources1 = new FontSources() {{
    setFontFolders(fontFolders1);
    setMemoryFonts(new byte[][] { memoryFont1 });
}};
final IFontSources fontSources2 = new FontSources() {{
    setFontFolders(fontFolders2);
    setMemoryFonts(new byte[][] { memoryFont2 });
}};
final IPresentation presentation1 = CreatePresentation("MyPresentation1.pptx", new LoadOptions(){{setDocumentLevelFontSources(fontSources1);}});
try{
    final IPresentation presentation2 = CreatePresentation("MyPresentation2.pptx", new LoadOptions(){{setDocumentLevelFontSources(fontSources2);}});
    try {
        //work with the presentations
        //CustomFont1 as well as fonts from assets\fonts folder and its subfolders are available to presentation1 but not to presentation2
        //CustomFont2 as well as fonts from global\fonts folder and its subfolders are available to presentation2 but not to presentation1
    }finally{
        presentation2.dispose();
    }
}finally {
    presentation1.dispose();
}

If you need to add external fonts at application level and make it available to all presentations please use FonsLoader class. You can use them together like as follows:

byte[] globalMemoryFont = ReadAllBytesFromFile("customfonts\CustomFont1.ttf");
byte[] localMemoryFont = ReadAllBytesFromFile("customfonts\CustomFont2.ttf");

ILoadOptions loadOptions = new LoadOptions();
loadOptions.getDocumentLevelFontSources().setFontFolders(new String[] { "assets\fonts" });
loadOptions.getDocumentLevelFontSources().setMemoryFonts(new byte[][] { localMemoryFont });

IPresentation presentation1 = CreatePresentation("MyPresentation.pptx", loadOptions);
try{
    //work with the presentation
    //CustomFont2 as well as fonts from assets\fonts folder and its subfolders are available to the presentation
    //CustomFont1 as well as fonts from global\fonts folder and its subfolders are unavailable to the presentation
}finally {
    presentation1.dispose();
}

FontsLoader.loadExternalFonts(new String[] { "global\fonts" });
FontsLoader.loadExternalFont(globalMemoryFont);

IPresentation presentation2 = CreatePresentation("MyPresentation.pptx", loadOptions);
try{
    //work with the presentation
    //CustomFont1 and CustomFont2 as well as fonts from global\fonts and assets\fonts folders and their subfolders are available to the presentation
}finally {
    presentation2.dispose();
}

CategoryAxisType.Auto value has been replaced with IAxis.setCategoryAxisTypeAutomatically() method in Aspose.Slides for Java

Method IAxis.setCategoryAxisTypeAutomatically() call IAxis.setCategoryAxisType method and set a value that is automatically determined based on axis data.

Obsolete com.aspose.slides.Presentation.getPresentationText methods have been deleted

Obsolete Presentation.getPresentationText methods have been deleted:

com.aspose.slides.Presentation.getPresentationText(InputStream stream, /*TextExtractionArrangingMode*/int mode)
com.aspose.slides.Presentation.getPresentationText(String file, /*TextExtractionArrangingMode*/int mode)
com.aspose.slides.Presentation.getPresentationText(InputStream stream, /*TextExtractionArrangingMode*/int mode, LoadOptions options)

Value HtmlNotes has been added to SaveFormat enumeration

Element HtmlNotes has been added to Aspose.Slides.Export.SaveFormat enumeration. This element allows saving presentation Notes Page View into HTML format.

Code example:

Presentation pres = new Presentation("Presentation.pptx");
try {
    // Saving notes pages
    pres.save("Output.html", SaveFormat.HtmlNotes);
} finally {
    pres.dispose();
}

Write document elements methods have been made non-final in EmbedAllFontsHtmlController class. WriteAllFonts method has been added.

writeDocumentStart, writeDocumentEnd, writeSlideStart, writeSlideEnd, writeShapeStart, writeShapeEnd methods have been made non-final to provide a better support to customize generated HTML documents.

In addition, writeAllFonts method has been added. It allows overriding the way how all fonts contained in the presentation are serialized into HTML.

Please review the example how to use overridable methods to create a custom HTML document with a link to CSS file.

public class CustomHeaderAndFontsController extends EmbedAllFontsHtmlController {
    // Custom header template
    final static String Header = "<!DOCTYPE html>\n" +
            "<html>\n" +
            "<head>\n" +
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" +
            "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\">\n" +
            "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">\n" +
            "</head>";


    private final String m_cssFileName;

    public CustomHeaderAndFontsController(String cssFileName) {
        m_cssFileName = cssFileName;
    }

    @Override
    public void writeDocumentStart(IHtmlGenerator generator, IPresentation presentation) {
        generator.addHtml(String.format(Header, m_cssFileName));
        writeAllFonts(generator, presentation);
    }

    @Override
    public void writeAllFonts(IHtmlGenerator generator, IPresentation presentation) {
        generator.addHtml("<!-- Embedded fonts -->");
        super.writeAllFonts(generator, presentation);
    }
}

There is the example how CustomHeaderAndFontsController can be used.

Presentation pres = new Presentation("pres.pptx");
try{
    final CustomHeaderAndFontsController htmlController = new CustomHeaderAndFontsController("styles.css");
    HtmlOptions options = new HtmlOptions(){{
        setHtmlFormatter(HtmlFormatter.createCustomFormatter(htmlController));
    }};
    pres.save("pres.html", SaveFormat.Html, options);
}finally {
    pres.dispose();
}