Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This Gist contains code snippets for doc to pdf in Python
The Gist contains code snippets related to MS Word (DOC) file conversion to PDF format using Aspose.Words Cloud SDK for Python.
# Get your ClientId and ClientSecret from
# input doc file path
fileName = '/Users/nayyershahbaz/Downloads/GetStyles.doc'
# filename on Cloud storage
remoteFileName = 'GetStyles.doc'
word_api_client: ApiClient = asposewordscloud.api_client.ApiClient("a41d01ef-dfd5-4e02-ad29-bd85fe41e3e4","d87269aade6a46cdc295b711e26809af")
words_api = WordsApi(word_api_client)
# Upload original document to Cloud Storage
words_api.upload_file(asposewordscloud.models.requests.UploadFileRequest(open(fileName, 'rb'), "", None))
# create ConvertDocument object
request = asposewordscloud.models.requests.ConvertDocumentRequest(remoteFileName, format, 'Resultant.pdf', None,None, None)
# perform document conversion
result = words_api.convert_document(request)
# print the result
print("Result {}".format(result))
except ApiException as e:
print("Exception while calling SlidesApi: {0}".format(e.message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment