Is there a cloud problem.
For your info, we use below code
public async Task Convert(string fullQualifiedFileName, CancellationToken cancellationToken = default)
{
if (!File.Exists(fullQualifiedFileName))
throw new FileNotFoundException($“File not found: {fullQualifiedFileName}”);
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
CellsApi cellsApi = new CellsApi(_clientId, _clientSecret);
using var fileStream = File.OpenRead(fullQualifiedFileName);
var request = new PutConvertWorkbookRequest
{
File = new Dictionary<string, Stream> { { Path.GetFileName(fullQualifiedFileName), fileStream } },
format = "pdf",
onePagePerSheet = false, // generates multiple pages
checkExcelRestriction = false
};
Task<Stream> convertTask = cellsApi.PutConvertWorkbookAsync(request);
Task delayTask = Task.Delay(Timeout.Infinite, linkedCts.Token);
if (await Task.WhenAny(convertTask, delayTask) == delayTask)
throw new TimeoutException($"Excel to PDF conversion timed out for: {fullQualifiedFileName}");
var response = await convertTask; // already completed, no await penalty
var memoryStream = new MemoryStream();
await response.CopyToAsync(memoryStream, cancellationToken);
memoryStream.Position = 0;
return memoryStream;
}