Translator.TranslateToImages

Translator TranslateToImages method. Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.

TranslateToImages(string, ImageSaveOptionsAiModelLanguage)

Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.

public static Stream[] TranslateToImages(string inputFile, ImageSaveOptions saveOptions, 
    AiModel model, Language language)
ParameterTypeDescription
inputFileStringThe input file name.
saveOptionsImageSaveOptionsImage save options.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
languageLanguageThe target language for AI-powered text translation.

Return Value

Returns array of image streams. The streams should be disposed by the end user.

Examples

Demonstrates how to translate a document and save the result as an array of image streams.

string apiUrl = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_URL", EnvironmentVariableTarget.User);
string apiName = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_NAME", EnvironmentVariableTarget.User);
string apiKey = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_KEY", EnvironmentVariableTarget.User);

AiModel model = OpenAiModel.Create(apiUrl, apiName, apiKey);

Stream[] pages = Translator.TranslateToImages(MyDir + "SimpleAI.docx", new ImageSaveOptions(SaveFormat.Png), model, Language.Ukrainian);

See Also


TranslateToImages(Stream, ImageSaveOptionsAiModelLanguage)

Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.

public static Stream[] TranslateToImages(Stream inputStream, ImageSaveOptions saveOptions, 
    AiModel model, Language language)
ParameterTypeDescription
inputStreamStreamThe input stream.
saveOptionsImageSaveOptionsImage save options.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
languageLanguageThe target language for AI-powered text translation.

Return Value

Returns array of image streams. The streams should be disposed by the end user.

See Also