Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active July 12, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/7b82969f05dc950a52ef570d3a43cdfd to your computer and use it in GitHub Desktop.
Save aspose-cloud/7b82969f05dc950a52ef570d3a43cdfd to your computer and use it in GitHub Desktop.
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 https://dashboard.aspose.cloud
# input doc file path
fileName = '/Users/nayyershahbaz/Downloads/GetStyles.doc'
# filename on Cloud storage
remoteFileName = 'GetStyles.doc'
try:
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