Free Support Forum -

Download DOCX to PDF converted file from cloud storage to disk using Python API

Hi, I want to convert my pdf files to docx. I followed the tutorials and successed to converted the files but I can’t download them. When I use convert_api.convert_document_download(request) function, it returns a path in temp directory on my computer but the converted file is not there.


We are sorry for your inconvenience. Please note, the file_api.download_file method writes response body into a temp file and returns file path. You may copy file to desired path as following. Hopefully it will help you to accomplish the task.

# Import module
import groupdocs_conversion_cloud

from shutil import copyfile

# Get your app_sid and app_key at (free registration is required).
app_sid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Create instance of the API
convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys(app_sid, app_key)
file_api = groupdocs_conversion_cloud.FileApi.from_keys(app_sid, app_key)


        #upload soruce file to storage
        filename = '02_pages.docx'
        request_download = groupdocs_conversion_cloud.DownloadFileRequest(filename)
        response_download = file_api.download_file(request_download)
        copyfile(response_download, 'C:/Temp/02_pages_copy.docx')

except groupdocs_conversion_cloud.ApiException as e:
        print("Exception : {0}".format(e.message))