Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This Gist contains code snippets related to conversion of PPT to PDF and PDF to PPT conversion in Python
This Gist contains code snippets related to conversion of PPT to PDF and PDF to PPT conversion using Aspose.Slides Cloud SDK for Python
def convert(name):
# initialize Aspose.Slides Cloud instnace.
configuration = asposeslidescloud.Configuration()
configuration.app_sid = "718e4235-8866-4ebe-bff4-f5a14a4b6466"
configuration.app_key = "388e864b819d8b067a8b1cb625a2ea8e"
slidesApi = asposeslidescloud.SlidesApi(configuration)
# load source PPTX file from local drive
try:
fileName = "/Users/nayyershahbaz/Documents/test.pdf"
with open(fileName, 'rb') as f:
file = f.read()
# Create SlideConvertRequest instance and provide input PPTX, resultant format and output file name
request = asposeslidescloud.models.requests.PostSlidesDocumentFromPdfRequest("output.pptx",file)
# Initiate the PPT conversion process
response = slidesApi.post_slides_document_from_pdf(request)
print("Result {0}".format(response))
except ApiException as e:
print("Exception while calling SlidesApi: {0}".format(e.message))
def convert(name):
# initialize Aspose.Slides Cloud instnace.
configuration = asposeslidescloud.Configuration()
configuration.app_sid = "718e4235-8866-4ebe-bff4-f5a14a4b6466"
configuration.app_key = "388e864b819d8b067a8b1cb625a2ea8e"
slidesApi = asposeslidescloud.SlidesApi(configuration)
# load source PPTX file from local drive
try:
fileName = "/Users/nayyershahbaz/Documents/Presentation1.pptx"
with open(fileName, 'rb') as f:
file = f.read()
# Create SlideConvertRequest instance and provide input PPTX, resultant format and output file name
request = asposeslidescloud.models.requests.PutSlidesConvertRequest(file, asposeslidescloud.models.ExportFormat.PDF,"converted.pdf")
# Initiate the PPT conversion process
response = slidesApi.put_slides_convert(request)
print("Result {0}".format(response))
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