Browse our Products

Aspose.Slides for Node.js via Java 26.7 Release Notes

KeySummaryCategory
SLIDESNODEJS-126Use Aspose.Slides for Java 26.7 featuresEnhancement

Public API Changes

Added New Class: AsposeAIWebClient

A built-in IAIWebClient implementation that connects to Aspose’s own LLM.

/**
 * <p>
 * Creates an instance of the Aspose AI web client that connects to the default Aspose LLM endpoint.
 * This is the client used by the parameterless {@code SlidesAIAgent()} constructor, so creating
 * it explicitly is only required when passing the client to the {@code SlidesAIAgent(IAIWebClient)}
 * constructor directly.
 * </p>
 */
public AsposeAIWebClient()

/**
 * <p>
 * Creates an instance of the Aspose AI web client that connects to the default Aspose LLM endpoint
 * using an externally managed {@code HttpURLConnection}. The provided {@code HttpURLConnection} is not
 * disposed by this instance and remains owned by the caller.
 * </p>
 * @exception ArgumentNullException HttpURLConnection instance is not provided.
 * @param httpClient An externally managed {@code HttpURLConnection} instance.
 */
public AsposeAIWebClient(HttpURLConnection httpClient)

/**
 * <p>
 * Creates an instance of the Aspose AI web client that connects to a custom endpoint URL. Use this
 * overload when you have a URL provided by the Aspose.Slides team; otherwise, use the
 * {@code AsposeAIWebClient()} overload with the default URL.
 * </p>
 * @exception ArgumentNullException URL can't be null or empty.
 * @param url Endpoint URL of the Aspose LLM, provided by the Aspose.Slides team.
 */
public AsposeAIWebClient(String url)

/**
 * <p>
 * Creates an instance of the Aspose AI web client that connects to a custom endpoint URL using an
 * externally managed {@code HttpURLConnection}. The provided {@code HttpURLConnection} is not disposed
 * by this instance and remains owned by the caller. Use this overload when you have a URL provided by
 * the Aspose.Slides team and want to supply your own {@code HttpURLConnection}; if you only need your
 * own {@code HttpURLConnection} with the default URL, use the {@code AsposeAIWebClient(HttpURLConnection)}
 * overload instead.
 * </p>
 * @exception ArgumentNullException URL can't be null or empty.
 * @exception ArgumentNullException HttpURLConnection instance is not provided.
 * @param url Endpoint URL of the Aspose LLM, provided by the Aspose.Slides team.
 * @param httpClient An externally managed {@code HttpURLConnection} instance.
 */
public AsposeAIWebClient(String url, HttpURLConnection httpClient)

/**
 * <p>
 * Sends a chat instruction to the AI model and returns response message to the given instruction.
 * @param instruction The instruction or message to be processed by the AI model.
 * @return The message generated by the AI model in response to the given instruction.
 * @exception com.aspose.ms.System.ArgumentException AI chat instruction can't be null or empty
 * </p>
 */
public String callChat(String instruction)

/**
 * <p>
 * Creates a conversation instance. Unlike regular AI calls, conversations retain the entire context.
 * </p>
 * @return An {@link IAIConversation} instance.
 */
public final IAIConversation createConversation()

/**
 * <p>
 * Releases resources used by this instance.
 * </p>
 */
public final void dispose()

Usage examples:

Default usage.

const aiClient = new aspose.slides.AsposeAIWebClient();
try {
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (aiClient) aiClient.dispose();
}

Externally managed HttpURLConnection.

const URL = java.import("java.net.URL");
const url = new URL(customUrl);
const httpClient = url.openConnection(); 

try {
    const aiClient = new aspose.slides.AsposeAIWebClient(httpClient);
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (httpClient) httpClient.disconnect();
}

Using a custom endpoint URL provided by the Aspose.Slides team.

const aiClient = new aspose.slides.AsposeAIWebClient(customUrl);
try {
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (aiClient) aiClient.dispose();
}

Using a custom endpoint URL provided by the Aspose.Slides team along with an externally managed HttpURLConnection.

const URL = java.import("java.net.URL");
const url = new URL(customUrl);
const httpClient = url.openConnection(); 

try {
    const aiClient = new aspose.slides.AsposeAIWebClient(customUrl, httpClient);
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (httpClient) httpClient.destroy();
}

Added New Class: OpenAICompatibleWebClient

A built-in IAIWebClient implementation that connects to an OpenAI-compatible LLM provider.

/**
 * <p>
 * Creates an instance of the OpenAI-compatible web client.
 * </p>
 * @exception ArgumentException API key value can't be null or empty.
 * @exception ArgumentException Text model value can't be null or empty.
 * @exception ArgumentException Base URL value can't be null or empty.
 * @param model Model name supported by the LLM provider.
 * @param apiKey API key (token).
 * @param baseUrl Base URL of the OpenAI-compatible LLM.
 */
public OpenAICompatibleWebClient(String model, String apiKey, String baseUrl)

/**
 * <p>
 * Creates an instance of the OpenAI-compatible web client that uses an externally managed {@code HttpURLConnection}.
 * The provided {@code HttpURLConnection} is not disposed by this instance and remains owned by the caller.
 * </p>
 * @exception ArgumentException API key value can't be null or empty.
 * @exception ArgumentException Text model value can't be null or empty.
 * @exception ArgumentException Base URL value can't be null or empty.
 * @exception ArgumentNullException HttpURLConnection can't be null.
 * @param model Model name supported by the LLM provider.
 * @param apiKey API key (token).
 * @param baseUrl Base URL of the OpenAI-compatible LLM.
 * @param httpClient An externally managed {@code HttpURLConnection} instance.
 */
public OpenAICompatibleWebClient(String model, String apiKey, String baseUrl, HttpURLConnection httpClient)

/**
 * <p>
 * Sends a chat instruction to the AI model using an externally managed `HttpClient` instance and returns response message to the given instruction.
 * </p>
 * @param instruction The instruction or message to be processed by the AI model.
 * @return The message generated by the AI model in response to the given instruction.
 * @exception com.aspose.ms.System.ArgumentException AI chat instruction can't be null or empty
 */
public String callChat(String instruction)

/**
 * <p>
 * Creates a conversation instance. Unlike regular AI calls, conversations retain the entire context.
 * </p>
 * @return An {@link IAIConversation} instance.
 */
public final IAIConversation createConversation()

/**
 * <p>
 * Releases resources used by this instance.
 * </p>
 */
public final void dispose()

Usage examples: Default usage:

const aiClient = new aspose.slides.OpenAICompatibleWebClient("model-name", apiKey, "https://api.llm-provider.com/v1");
try {
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (aiClient) aiClient.dispose();
}

Externally managed HttpURLConnection.

const URL = java.import("java.net.URL");
const url = new URL(baseUrl);
const httpClient = url.openConnection();

try {
    const aiClient = new aspose.slides.OpenAICompatibleWebClient("model-name", apiKey, "https://api.llm-provider.com/v1", httpClient);
    const aiAgent = new aspose.slides.SlidesAIAgent(aiClient);
    const presentation = new aspose.slides.Presentation("Presentation.pptx");
    try {
        aiAgent.translate(presentation, "spanish");
        presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
    } finally {
        if (presentation) presentation.dispose();
    }
} finally {
    if (httpClient) httpClient.disconnectSync();
}

Added New Constructor to the Class: SlidesAIAgent

/**
 * <p>
 * Initializes a new instance of {@link SlidesAIAgent} using the built-in
 * {@link AsposeAIWebClient} with its default configuration. The client connects to
 * Aspose's own LLM and requires no additional configuration.
 * To use a different AI client, use the {@link SlidesAIAgent(IAIWebClient)} overload instead.
 * </p>
 */
public SlidesAIAgent()

Usage example:

const presentation = new aspose.slides.Presentation("Presentation.pptx");
try {
    const aiAgent = new aspose.slides.SlidesAIAgent();
    aiAgent.translate(presentation, "spanish");
    presentation.save("translated.pptx", aspose.slides.SaveFormat.Pptx);
} finally {
    if (presentation) presentation.dispose();
}

Added New Property: IHtml5Options.PicturesCompression

A new PicturesCompression property has been added to the IHtml5Options interface and its implementation, Html5Options. This property works in the same way as IHtmlOptions.PicturesCompression.

Image compression is applied according to the image usage bounds in the exported document and the selected DPI. For example, suppose there is an image on a slide with an original size of 1000×1000 pixels, and the image is scaled to 100×100 pixels on the slide. If PicturesCompression is set to Dpi72, the image will be exported at 100×100 pixels. If, under the same conditions, PicturesCompression is set to Dpi150, the image will be exported at 208×208 pixels (100 × 150 / 72). The DocumentResolution value preserves the original image dimensions. The default value is PicturesCompression.DocumentResolution.

The following code example demonstrates how to use this property:

const pres = new aspose.slides.Presentation(presFilePath);
try {
    const options = new aspose.slides.Html5Options();
    options.setPicturesCompression(aspose.slides.PicturesCompression.Dpi150);
    
    pres.save(html5OutPath, aspose.slides.SaveFormat.Html5, options);
} finally {
    if (pres) pres.dispose();
}