Converting RTF to PDF via Aspose Cloud API results in an exception. Please see the exception details and sample code below. The error is not reproduced when fontsLocation
is not specified.
Internal storage is configured as default for the Aspose application, with a “fonts” directory containing 4 files: cour.ttf, courbd.ttf, courbi.ttf, couri.ttf.
Aspose.Words.Cloud.Sdk.ApiException: Error while get files in folder 'fonts' from storage: Error while get file list in folder 'fonts' from storage: AmazonS3 Storage exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
at Aspose.Words.Cloud.Sdk.RequestHandlers.ApiExceptionRequestHandler.ThrowApiException(HttpResponseMessage response)
at Aspose.Words.Cloud.Sdk.RequestHandlers.ApiExceptionRequestHandler.ProcessResponse(HttpResponseMessage response)
at Aspose.Words.Cloud.Sdk.ApiInvoker.InvokeApiInternal(HttpRequestMessage httpRequest)
at Aspose.Words.Cloud.Sdk.ApiInvoker.InvokeApi(Func`1 httpRequestFactory)
at Aspose.Words.Cloud.Sdk.WordsApi.ConvertDocument(ConvertDocumentRequest request)
var configuration = new Configuration
{
ClientId = AsposeClientId,
ClientSecret = AsposeClientSecret
};
var wordsApi = new WordsApi(configuration);
wordsApi.HttpClient.Timeout = TimeSpan.FromMinutes(10);
Console.WriteLine("Calling Aspose API...");
try
{
var request = new ConvertDocumentRequest(inputStream, "pdf", fontsLocation: "fonts");
using var resultStream = await wordsApi.ConvertDocument(request);
Console.WriteLine("Saving PDF output...");
using var fileStream = File.Create(outputFilePath);
await resultStream.CopyToAsync(fileStream);
Console.WriteLine($"Conversion complete! Output saved to: {outputFilePath}");
}
catch (Exception ex)
{
Console.WriteLine("Error during PDF conversion:");
Console.WriteLine(ex);
}