We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Export DOCX to PDF in C# Using SaveAs API Method of Aspose.Words REST API

I’m using Aspose.Words.Cloud.Sdk Version=21.5.0.0 to make a pdf of my document. The problem is that I don’t get any feedback from the SaveAs call, not even an error.
Here is my code:

public async Task SaveAsPdf(string fileName)
{

        var request = new SaveAsRequest(
         name: fileName,
         saveOptionsData: new SaveOptionsData()
         {
             SaveFormat = "pdf",
             FileName = Path.GetFileNameWithoutExtension(fileName) + ".pdf"
         },
         folder: null,
         storage: storage
       );

        return await WordsApi.SaveAs(request);

    }

@jeducre

I have tested the SaveAs API method to export DOCX to PDF in C# using Aspose.Words Cloud SDK for .NET 22.1 and unable to notice the reported issue. Please upgrade to the latest version of Aspose.Words Cloud SDK, it will resolve the issue.

Convert DOCX File to PDF in C# Online

WordsApi wordsApi = new WordsApi(ClientId, ClientSecret);

string localName = "02_pages.docx";
string remoteName = "TestSaveAs.docx";
string remoteFolder = "Temp";
string localFolder = @"C:/Temp";


//Upload file to cloud storage
var localDataFullName = Path.Combine(localFolder, localName);
var fullNameData = Path.Combine(remoteFolder, remoteName);
var requestDataUpload = new Aspose.Words.Cloud.Sdk.Model.Requests.UploadFileRequest(System.IO.File.OpenRead(localDataFullName), fullNameData);
await wordsApi.UploadFile(requestDataUpload);

//Convert DOCX to PDF
var requestSaveOptionsData = new PdfSaveOptionsData()
{
    FileName = "TestSaveAs.pdf"
};
var request = new SaveAsRequest(
    name: remoteName,
    saveOptionsData: requestSaveOptionsData,
    folder: remoteFolder
);
var actual = await wordsApi.SaveAs(request);
Console.WriteLine(actual);