Last active
February 26, 2021 07:30
-
-
Save groupdocscloud/c5f65caff3accc22d8dc1d9da2dc735c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conversion-Python-V2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client_id = "112f0f38-9dae-42d5-b4fc-cc84ae644972" | |
client_secret = "16ad3fe0bdc39c910f57d2fd48a5d618" | |
my_storage = "" | |
configuration = groupdocs_conversion_cloud.Configuration(client_id, client_secret) | |
configuration.api_base_url = "https://api.groupdocs.cloud" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "html" | |
convertOptions = groupdocs_conversion_cloud.HtmlConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.fixed_layout = True | |
settings.convert_options = convertOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "jpg" | |
convertOptions = groupdocs_conversion_cloud.JpgConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 2 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/password-protected.docx" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.center_window = True | |
convertOptions.compress_images = False | |
convertOptions.display_doc_title = True | |
convertOptions.dpi = 1024.0 | |
convertOptions.fit_window = False | |
convertOptions.from_page = 1 | |
convertOptions.grayscale = False | |
convertOptions.image_quality = 100 | |
convertOptions.linearize = False | |
convertOptions.margin_top = 5 | |
convertOptions.margin_left = 5 | |
convertOptions.password = "password" | |
convertOptions.unembed_fonts = True | |
convertOptions.remove_unused_streams = True | |
convertOptions.remove_unused_objects = True | |
convertOptions.remove_pdfa_compliance = False | |
settings.load_options = loadOptions | |
settings.convert_options = convertOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "ppt" | |
convertOptions = groupdocs_conversion_cloud.PresentationConvertOptions() | |
convertOptions.from_page = 2 | |
convertOptions.pages_count = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "xlsx" | |
settings.convert_options = groupdocs_conversion_cloud.SpreadsheetConvertOptions() | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Pdf/sample.pdf" | |
settings.format = "docx" | |
loadOptions = groupdocs_conversion_cloud.PdfLoadOptions() | |
loadOptions.password = "" | |
loadOptions.hide_pdf_annotations = True | |
loadOptions.remove_embedded_files = False | |
loadOptions.flatten_all_fields = True | |
settings.load_options = loadOptions | |
settings.convert_options = groupdocs_conversion_cloud.DocxConvertOptions() | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "pdf" | |
settings.convert_options = groupdocs_conversion_cloud.PdfConvertOptions() | |
watermark = groupdocs_conversion_cloud.WatermarkOptions() | |
watermark.text = "Sample watermark" | |
watermark.color = "Red" | |
watermark.width = 100 | |
watermark.height = 100 | |
watermark.background = True | |
settings.watermark_options = watermark | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "pdf" | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.from_page = 2 | |
convertOptions.pages_count = 2 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted/two-pages.pdf" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/four-pages.docx" | |
settings.format = "pdf" | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.pages = [1, 3] | |
settings.convert_options = convertOptions | |
settings.output_path = "converted/two-pages.pdf" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "sample.mpp" | |
settings.format = "pdf" | |
settings.output_path = "Output" | |
# PDF convert options | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.center_window = True | |
convertOptions.compress_images = False | |
convertOptions.display_doc_title = True | |
convertOptions.dpi = 1024.0 | |
convertOptions.fit_window = False | |
convertOptions.from_page = 1 | |
convertOptions.grayscale = False | |
convertOptions.image_quality = 100 | |
convertOptions.linearize = False | |
convertOptions.margin_top = 5 | |
convertOptions.margin_left = 5 | |
convertOptions.unembed_fonts = True | |
convertOptions.remove_unused_streams = True | |
convertOptions.remove_unused_objects = True | |
convertOptions.remove_pdfa_compliance = False | |
settings.convert_options = convertOptions | |
# Prepare request | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
# Convert | |
result = apiInstance.convert_document(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret) | |
# Prepare request | |
request = groupdocs_conversion_cloud.ConvertDocumentDirectRequest("pdf", "C:\\Files\\sample.mpp") | |
# Convert | |
result = apiInstance.convert_document_direct(request) | |
# Move downloaded file to your working directory | |
shutil.move(result, "C:\\Files\\") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Any_Format: | |
@classmethod | |
def Run(self, strformat, convertOptions): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = strformat | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\" + strformat | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Any_Format_Stream: | |
@classmethod | |
def Run(self, strformat, convertOptions): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = strformat | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Cells: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "xlsx" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.XlsxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.password = "password" | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\tocells" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Cells_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "xlsx" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.XlsxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.password = "password" | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Html: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "html" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.HtmlConvertOptions() | |
convertOptions.fixed_layout = True | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\tohtml" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Html_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "html" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.HtmlConvertOptions() | |
convertOptions.fixed_layout = True | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Images: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "jpeg" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.JpegConvertOptions() | |
convertOptions.gray_scale = True | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.quality = 100 | |
convertOptions.rotate_angle = 90 | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\tojpeg" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Images_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "jpeg" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.JpegConvertOptions() | |
convertOptions.gray_scale = True | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.quality = 100 | |
convertOptions.rotate_angle = 90 | |
convertOptions.use_pdf = False | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Pdf: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "jpeg" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.bookmarks_outline_level = 1; | |
convertOptions.center_window = True | |
convertOptions.compress_images = False; | |
convertOptions.display_doc_title = True | |
convertOptions.dpi = 1024 | |
convertOptions.expanded_outline_levels = 1 | |
convertOptions.fit_window = False | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.grayscale = True | |
convertOptions.headings_outline_levels = 1 | |
convertOptions.image_quality = 100 | |
convertOptions.linearize = False | |
convertOptions.margin_top = 5 | |
convertOptions.margin_left = 5 | |
convertOptions.password = "password" | |
convertOptions.unembed_fonts = True | |
convertOptions.remove_unused_streams = True | |
convertOptions.remove_unused_objects = True | |
convertOptions.remove_pdfa_compliance = False | |
convertOptions.height = 1024 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\topdf" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Pdf_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\password-protected.docx" | |
settings.format = "jpeg" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.password = "password" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.PdfConvertOptions() | |
convertOptions.bookmarks_outline_level = 1; | |
convertOptions.center_window = True | |
convertOptions.compress_images = False; | |
convertOptions.display_doc_title = True | |
convertOptions.dpi = 1024 | |
convertOptions.expanded_outline_levels = 1 | |
convertOptions.fit_window = False | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.grayscale = True | |
convertOptions.headings_outline_levels = 1 | |
convertOptions.image_quality = 100 | |
convertOptions.linearize = False | |
convertOptions.margin_top = 5 | |
convertOptions.margin_left = 5 | |
convertOptions.password = "password" | |
convertOptions.unembed_fonts = True | |
convertOptions.remove_unused_streams = True | |
convertOptions.remove_unused_objects = True | |
convertOptions.remove_pdfa_compliance = False | |
convertOptions.height = 1024 | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Slides: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = "pptx" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.hide_word_tracked_changes = True | |
loadOptions.default_font = "Arial" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.PptxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.zoom = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\topptx" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Slides_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = "pptx" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.hide_word_tracked_changes = True | |
loadOptions.default_font = "Arial" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.PptxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
convertOptions.zoom = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Text: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = "txt" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.hide_word_tracked_changes = True | |
loadOptions.default_font = "Arial" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.TxtConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\totxt" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Text_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "conversions\\sample.docx" | |
settings.format = "txt" | |
loadOptions = groupdocs_conversion_cloud.DocxLoadOptions() | |
loadOptions.hide_word_tracked_changes = True | |
loadOptions.default_font = "Arial" | |
settings.load_options = loadOptions; | |
convertOptions = groupdocs_conversion_cloud.TxtConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Words: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "converted/topdf/password-protected.pdf" | |
settings.format = "docx" | |
loadOptions = groupdocs_conversion_cloud.PdfLoadOptions() | |
loadOptions.password = "password" | |
loadOptions.hide_pdf_annotations = True | |
loadOptions.remove_embedded_files = False | |
loadOptions.flatten_all_fields = True | |
settings.load_options = loadOptions | |
convertOptions = groupdocs_conversion_cloud.DocxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = "converted\\todocx" | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document(request) | |
print("Document converted successfully: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Convert_To_Words_Stream: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ConvertApi_Instance() | |
try: | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.storage_name = Common_Utilities.myStorage; | |
settings.file_path = "converted/topdf/password-protected.pdf" | |
settings.format = "docx" | |
loadOptions = groupdocs_conversion_cloud.PdfLoadOptions() | |
loadOptions.password = "password" | |
loadOptions.hide_pdf_annotations = True | |
loadOptions.remove_embedded_files = False | |
loadOptions.flatten_all_fields = True | |
settings.load_options = loadOptions | |
convertOptions = groupdocs_conversion_cloud.DocxConvertOptions() | |
convertOptions.from_page = 1 | |
convertOptions.pages_count = 1 | |
settings.convert_options = convertOptions | |
settings.output_path = None # leave OutputPath will result the output as document IOStream | |
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings) | |
response = api.convert_document_download(request) | |
print("Document converted successfully: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Copy_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.CopyFileRequest("conversions\\one-page.docx", "conversions\\one-page-copied.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_file(request) | |
print("Expected response type is Void: 'conversions/one-page.docx' file copied as 'conversions/one-page-copied.docx'.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Copy_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.CopyFolderRequest("conversions", "conversions1", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_folder(request) | |
print("Expected response type is Void: 'conversions' folder copied as 'conversions1'.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Create_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.CreateFolderRequest("conversions", Common_Utilities.myStorage) | |
api.create_folder(request) | |
print("Expected response type is Void: 'conversions' folder created.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Delete_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.DeleteFileRequest("conversions1\\one-page.docx", Common_Utilities.myStorage) | |
api.delete_file(request) | |
print("Expected response type is Void: 'conversions1/one-page.docx' deleted.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Delete_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.DeleteFolderRequest("conversions\\conversions1", Common_Utilities.myStorage, True) | |
api.delete_folder(request) | |
print("Expected response type is Void: 'conversions/conversions1' folder deleted recursively.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Download_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.DownloadFileRequest("conversions\\one-page.docx", Common_Utilities.myStorage) | |
response = api.download_file(request) | |
print("Expected response type is Stream: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create File API instance | |
file_api = groupdocs_conversion_cloud.FileApi.from_config(configuration) | |
request = groupdocs_conversion_cloud.DownloadFileRequest("Output\\sample.pdf", my_storage) | |
response = file_api.download_file(request) | |
# Move downloaded file to your working directory | |
shutil.move(response, "C:\\Files\\") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_All_Supported_Formats: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
# Retrieve supported conversion types | |
request = groupdocs_conversion_cloud.GetSupportedConversionTypesRequest() | |
response = api.get_supported_conversion_types(request) | |
# Print out supported conversion types | |
print("Supported conversion types:") | |
for fileformat in response: | |
print('{0} to [{1}]'.format(fileformat.source_format, ', '.join(fileformat.target_formats))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception when calling get_supported_conversion_types: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_All_Supported_Formats_For_Document: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
# Retrieve supported conversion types | |
request = groupdocs_conversion_cloud.GetSupportedConversionTypesRequest("conversions\\one-page.docx", Common_Utilities.myStorage, "") | |
response = api.get_supported_conversion_types(request) | |
# Print out supported conversion types | |
print("Supported conversion types:") | |
for fileformat in response: | |
print('{0} to [{1}]'.format(fileformat.source_format, ', '.join(fileformat.target_formats))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception when calling get_supported_conversion_types: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_All_Supported_Formats_For_Extension: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
# Retrieve supported conversion types | |
request = groupdocs_conversion_cloud.GetSupportedConversionTypesRequest("", Common_Utilities.myStorage, "xlsx") | |
response = api.get_supported_conversion_types(request) | |
# Print out supported conversion types | |
print("Supported conversion types:") | |
for fileformat in response: | |
print('{0} to [{1}]'.format(fileformat.source_format, ', '.join(fileformat.target_formats))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception when calling get_supported_conversion_types: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_Disc_Usage: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.GetDiscUsageRequest(Common_Utilities.myStorage) | |
response = api.get_disc_usage(request) | |
print("Expected response type is DiscUsage: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_Document_Information: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.GetDocumentMetadataRequest() | |
request.storage_name = Common_Utilities.myStorage; | |
request.file_path = "conversions\\password-protected.docx" | |
response = api.get_document_metadata(request) | |
print("Expected response type is DocumentMetadata: " + str(len(response))) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_File_Versions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.GetFileVersionsRequest("conversions\\one-page.docx", Common_Utilities.myStorage) | |
response = api.get_file_versions(request) | |
print("Expected response type is FileVersions: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Get_Files_List: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.GetFilesListRequest("conversions\\sample.docx", Common_Utilities.myStorage) | |
response = api.get_files_list(request) | |
print("Expected response type is FilesList: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Cad/Sample.dwg" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.CadLoadOptions() | |
loadOptions.width = 1920 | |
loadOptions.height = 1080 | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Spreadsheet/sample.csv" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.CsvLoadOptions() | |
loadOptions.separator = "," | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Email/sample.msg" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.EmailLoadOptions() | |
loadOptions.display_header = False | |
loadOptions.display_from_email_address = False | |
loadOptions.display_to_email_address = False | |
loadOptions.display_email_address = False | |
loadOptions.display_cc_email_address = False | |
loadOptions.display_bcc_email_address = False | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Note/sample.one" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.OneLoadOptions() | |
loadOptions.font_substitutes = {"Tahoma" : "Arial", "Times New Roman" : "Arial"} | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Pdf/sample.pdf" | |
settings.format = "docx" | |
loadOptions = groupdocs_conversion_cloud.PdfLoadOptions() | |
loadOptions.hide_pdf_annotations = True | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Presentation/with_notes.pptx" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.PresentationLoadOptions() | |
loadOptions.hide_comments = True | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Spreadsheet/sample.xlsx" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.SpreadsheetLoadOptions() | |
loadOptions.hide_comments = True | |
loadOptions.one_page_per_sheet = True | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "Text/sample.txt" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.TxtLoadOptions() | |
loadOptions.encoding = "shift_jis" | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples | |
import groupdocs_conversion_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
# Create necessary API instances | |
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(Common.app_sid, Common.app_key) | |
# Prepare convert settings | |
settings = groupdocs_conversion_cloud.ConvertSettings() | |
settings.file_path = "WordProcessing/with_tracked_changes.docx" | |
settings.format = "pdf" | |
loadOptions = groupdocs_conversion_cloud.WordProcessingLoadOptions() | |
loadOptions.hide_comments = True | |
settings.load_options = loadOptions | |
settings.output_path = "converted" | |
# Convert | |
result = apiInstance.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Move_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.MoveFileRequest("conversions\\one-page.docx", "conversions1\\one-page.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_file(request) | |
print("Expected response type is Void: 'conversions/one-page.docx' file moved to 'conversions1/one-page.docx'.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Move_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.MoveFolderRequest("conversions1", "conversions1\\conversions", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_folder(request) | |
print("Expected response type is Void: 'conversions1' folder moved to 'conversions/conversions1'.") | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Object_Exists: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.ObjectExistsRequest("conversions\\one-page.docx", Common_Utilities.myStorage) | |
response = api.object_exists(request) | |
print("Expected response type is ObjectExist: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required). | |
Common_Utilities.host_url = "http://api.groupdocs.cloud" # Put your Host URL here | |
Common_Utilities.app_sid = "XXXXX-XXXXX-XXXXX-XXXXX" | |
Common_Utilities.app_key = "XXXXXXXXXXXXXXX" | |
Common_Utilities.myStorage = "XXXXX" | |
# ######################################### | |
# print("Executing Upload Test Files...") | |
# Common_Utilities.Upload_Test_Files() | |
# ######################################### | |
########################################### | |
#******* Execute Examples ******* | |
print("*** Executing examples...") | |
#******* Execute Examples ******* | |
########################################### | |
######################################### | |
print("*** Executing Get_Supported_File_Formats...") | |
######################################### | |
print("* Executing Conversion_Python_Get_All_Supported_Formats...") | |
from Supported_File_Formats.Conversion_Python_Get_All_Supported_Formats import Conversion_Python_Get_All_Supported_Formats | |
Conversion_Python_Get_All_Supported_Formats.Run() | |
# print("* Executing Conversion_Python_Get_All_Supported_Formats_For_Document...") | |
# from Supported_File_Formats.Conversion_Python_Get_All_Supported_Formats_For_Document import Conversion_Python_Get_All_Supported_Formats_For_Document | |
# Conversion_Python_Get_All_Supported_Formats_For_Document.Run() | |
# print("* Executing Conversion_Python_Get_All_Supported_Formats_For_Extension...") | |
# from Supported_File_Formats.Conversion_Python_Get_All_Supported_Formats_For_Extension import Conversion_Python_Get_All_Supported_Formats_For_Extension | |
# Conversion_Python_Get_All_Supported_Formats_For_Extension.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Storage...") | |
# ########################################## | |
# print("* Executing Conversion_Python_Storage_Exist...") | |
# from Working_With_Storage.Conversion_Python_Storage_Exist import Conversion_Python_Storage_Exist | |
# Conversion_Python_Storage_Exist.Run() | |
# print("* Executing Conversion_Python_Object_Exists...") | |
# from Working_With_Storage.Conversion_Python_Object_Exists import Conversion_Python_Object_Exists | |
# Conversion_Python_Object_Exists.Run() | |
# print("* Executing Conversion_Python_Get_File_Versions...") | |
# from Working_With_Storage.Conversion_Python_Get_File_Versions import Conversion_Python_Get_File_Versions | |
# Conversion_Python_Get_File_Versions.Run() | |
# print("* Executing Conversion_Python_Get_Disc_Usage...") | |
# from Working_With_Storage.Conversion_Python_Get_Disc_Usage import Conversion_Python_Get_Disc_Usage | |
# Conversion_Python_Get_Disc_Usage.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Folder...") | |
# ########################################## | |
# print("* Executing Conversion_Python_Create_Folder...") | |
# from Working_With_Folder.Conversion_Python_Create_Folder import Conversion_Python_Create_Folder | |
# Conversion_Python_Create_Folder.Run() | |
# print("* Executing Conversion_Python_Copy_Folder...") | |
# from Working_With_Folder.Conversion_Python_Copy_Folder import Conversion_Python_Copy_Folder | |
# Conversion_Python_Copy_Folder.Run() | |
# print("* Executing Conversion_Python_Get_Files_List...") | |
# from Working_With_Folder.Conversion_Python_Get_Files_List import Conversion_Python_Get_Files_List | |
# Conversion_Python_Get_Files_List.Run() | |
# print("* Executing Conversion_Python_Move_Folder...") | |
# from Working_With_Folder.Conversion_Python_Move_Folder import Conversion_Python_Move_Folder | |
# Conversion_Python_Move_Folder.Run() | |
# print("* Executing Conversion_Python_Delete_Folder...") | |
# from Working_With_Folder.Conversion_Python_Delete_Folder import Conversion_Python_Delete_Folder | |
# Conversion_Python_Delete_Folder.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Files...") | |
# ########################################## | |
# print("* Executing Conversion_Python_Upload_File...") | |
# from Working_With_Files.Conversion_Python_Upload_File import Conversion_Python_Upload_File | |
# Conversion_Python_Upload_File.Run() | |
# print("* Executing Conversion_Python_Download_File...") | |
# from Working_With_Files.Conversion_Python_Download_File import Conversion_Python_Download_File | |
# Conversion_Python_Download_File.Run() | |
# print("* Executing Conversion_Python_Copy_File...") | |
# from Working_With_Files.Conversion_Python_Copy_File import Conversion_Python_Copy_File | |
# Conversion_Python_Copy_File.Run() | |
# print("* Executing Conversion_Python_Move_File...") | |
# from Working_With_Files.Conversion_Python_Move_File import Conversion_Python_Move_File | |
# Conversion_Python_Move_File.Run() | |
# print("* Executing Conversion_Python_Delete_File...") | |
# from Working_With_Files.Conversion_Python_Delete_File import Conversion_Python_Delete_File | |
# Conversion_Python_Delete_File.Run() | |
########################################## | |
print("*** Executing Working_With_Conversions...") | |
########################################## | |
print("* Executing Conversion_Python_Convert_To_Any_Format...") | |
from Working_With_Conversions.Conversion_Python_Convert_To_Any_Format import Conversion_Python_Convert_To_Any_Format | |
convertOptions = groupdocs_conversion_cloud.JpgConvertOptions() | |
Conversion_Python_Convert_To_Any_Format.Run("jpg", convertOptions) | |
# print("* Executing Conversion_Python_Convert_To_Any_Format_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Any_Format_Stream import Conversion_Python_Convert_To_Any_Format_Stream | |
# convertOptions = groupdocs_conversion_cloud.JpgConvertOptions() | |
# Conversion_Python_Convert_To_Any_Format_Stream.Run("jpg", convertOptions) | |
# print("* Executing Conversion_Python_Convert_To_Cells...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Cells import Conversion_Python_Convert_To_Cells | |
# Conversion_Python_Convert_To_Cells.Run() | |
# print("* Executing Conversion_Python_Convert_To_Cells_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Cells_Stream import Conversion_Python_Convert_To_Cells_Stream | |
# Conversion_Python_Convert_To_Cells_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Html...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Html import Conversion_Python_Convert_To_Html | |
# Conversion_Python_Convert_To_Html.Run() | |
# print("* Executing Conversion_Python_Convert_To_Html_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Html_Stream import Conversion_Python_Convert_To_Html_Stream | |
# Conversion_Python_Convert_To_Html_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Images...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Images import Conversion_Python_Convert_To_Images | |
# Conversion_Python_Convert_To_Images.Run() | |
# print("* Executing Conversion_Python_Convert_To_Images_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Images_Stream import Conversion_Python_Convert_To_Images_Stream | |
# Conversion_Python_Convert_To_Images_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Pdf...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Pdf import Conversion_Python_Convert_To_Pdf | |
# Conversion_Python_Convert_To_Pdf.Run() | |
# print("* Executing Conversion_Python_Convert_To_Pdf_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Pdf_Stream import Conversion_Python_Convert_To_Pdf_Stream | |
# Conversion_Python_Convert_To_Pdf_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Slides...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Slides import Conversion_Python_Convert_To_Slides | |
# Conversion_Python_Convert_To_Slides.Run() | |
# print("* Executing Conversion_Python_Convert_To_Slides_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Slides_Stream import Conversion_Python_Convert_To_Slides_Stream | |
# Conversion_Python_Convert_To_Slides_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Text...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Text import Conversion_Python_Convert_To_Text | |
# Conversion_Python_Convert_To_Text.Run() | |
# print("* Executing Conversion_Python_Convert_To_Text_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Text_Stream import Conversion_Python_Convert_To_Text_Stream | |
# Conversion_Python_Convert_To_Text_Stream.Run() | |
# print("* Executing Conversion_Python_Convert_To_Words...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Words import Conversion_Python_Convert_To_Words | |
# Conversion_Python_Convert_To_Words.Run() | |
# print("* Executing Conversion_Python_Convert_To_Words_Stream...") | |
# from Working_With_Conversions.Conversion_Python_Convert_To_Words_Stream import Conversion_Python_Convert_To_Words_Stream | |
# Conversion_Python_Convert_To_Words_Stream.Run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Storage_Exist: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.StorageExistsRequest(Common_Utilities.myStorage) | |
response = api.storage_exists(request) | |
print("Expected response type is StorageExist: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_conversion_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Conversion_Python_Upload_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_conversion_cloud.UploadFileRequest("conversions\\one-page.docx", "D:\\ewspace\\GroupDocs.Conversion.Cloud.Python.Examples\\src\\Resources\\conversions\\one-page.docx", Common_Utilities.myStorage) | |
response = api.upload_file(request) | |
print("Expected response type is FilesUploadResult: " + str(response)) | |
except groupdocs_conversion_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create instance of the API | |
file_api = groupdocs_conversion_cloud.FileApi.from_config(configuration) | |
request = groupdocs_conversion_cloud.UploadFileRequest("sample.mpp", "C:\\Files\\sample.mpp", my_storage) | |
response = file_api.upload_file(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groupdocs_conversion_cloud | |
import os | |
class Common_Utilities: | |
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required). | |
app_sid = None | |
app_key = None | |
host_url = None | |
myStorage = None | |
@classmethod | |
def Get_ConvertApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_conversion_cloud.ConvertApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_InfoApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_conversion_cloud.InfoApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_StorageApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_conversion_cloud.StorageApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_FolderApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_conversion_cloud.FolderApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_FileApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_conversion_cloud.FileApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Upload_Test_Files(self): | |
dirName = "D:\\ewspace\\GroupDocs.Conversion.Cloud.Python.Examples\\src\\Resources\\conversions\\" | |
TestFiles = Common_Utilities.getListOfFiles(dirName) | |
# api initialization | |
storageApi = Common_Utilities.Get_StorageApi_Instance() | |
fileApi = Common_Utilities.Get_FileApi_Instance() | |
print("Files Count: " + str(len(TestFiles))) | |
for item in TestFiles: | |
print("File to Upload: "+ dirName + item) | |
# skip existing file uploading | |
fileExistRequest = groupdocs_conversion_cloud.ObjectExistsRequest(dirName + item) | |
fileExistsResponse = storageApi.object_exists(fileExistRequest) | |
if not fileExistsResponse.exists: | |
# file content uploading | |
putCreateRequest = groupdocs_conversion_cloud.UploadFileRequest('conversions\\' + item, dirName + item) | |
fileApi.upload_file(putCreateRequest) | |
print("Uploaded missing file: "+ 'conversions\\' + item) | |
print("File Uploading completed..") | |
@classmethod | |
def getListOfFiles(self, dirName): | |
# create a list of file and sub directories | |
# names in the given directory | |
listOfFile = os.listdir(dirName) | |
allFiles = list() | |
# Iterate over all the entries | |
for entry in listOfFile: | |
# Create full path | |
fullPath = os.path.join("", entry) | |
# If entry is a directory then get the list of files in this directory | |
if os.path.isdir(fullPath): | |
allFiles = allFiles + Common_Utilities.getListOfFiles(fullPath) | |
else: | |
allFiles.append(fullPath) | |
return allFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment