Convert Pdf stream to docx stream in memory using cloud sdk

Hey im using the aspose pdf cloud sdk and im trying to create an api where users send pdf documents and it converts it to docx and sends it back to the user.

 var filePath = Path.GetRandomFileName();
            await using var stream = File.Create(filePath);
            await file.CopyToAsync(stream);
            UploadFile(filePath, file.FileName);
            var response = await _asposePdfApi.GetPdfInStorageToDocAsync(file.FileName, folder: "");
            return response;

This is what i tried, but in every sceneario i have seen in the examples the file has to exist on the system first. i want a way to convert it from an in memory stream of pdf to an in memory stream of doc or docx. how do i go about doing that? thanks

@DBankx

Please check the following API methods. You need to use PutPdfInRequestToDoc to convert PDF documents from the request body and download the result as a response. It will help you accomplish the requirement.

PUT ​/pdf​/convert​/doc Converts PDF document (in request content) to DOC format and uploads resulting file to storage.

​GET /pdf​/storage​/file​/{path} Download file