Last active
February 18, 2021 05:45
-
-
Save groupdocscloud/46af986198f1d3f84ef2db07ef9a56f9 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
Viewer-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 = "YOUR-CLIENT-ID" | |
client_secret = "YOUR-CLIENT-SECRET" | |
my_storage = "" | |
configuration = groupdocs_viewer_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
# Import modules | |
import groupdocs_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Copy_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.CopyFileRequest("viewerdocs\\one-page.docx", "viewerdocs\\one-page-copied.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_file(request) | |
print("Expected response type is Void: 'viewerdocs/one-page.docx' file copied as 'viewerdocs/one-page-copied.docx'.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Copy_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.CopyFolderRequest("viewerdocs", "viewerdocs1", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_folder(request) | |
print("Expected response type is Void: 'viewerdocs' folder copied as 'viewerdocs1'.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.CreateFolderRequest("Assembler", Common_Utilities.myStorage) | |
api.create_folder(request) | |
print("Expected response type is Void: 'Assembler' folder created.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_CAD_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\three-layouts.dwf" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
cadOptions = groupdocs_viewer_cloud.CadOptions() | |
cadOptions.scale_factor = 50 | |
renderOptions.cad_options = cadOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_Fonts_Path_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\uses-custom-font.pptx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.view_format = "PNG" | |
viewOptions.fonts_path = "font/ttf" | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_HTML_View_Format: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.view_format = "HTML" | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_HTML_ViewOptions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\three-layouts.dwf" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.HtmlOptions() | |
renderOptions.external_resources = True | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_Image_View_Format: | |
@classmethod | |
def Run(self, viewFormat): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.view_format = viewFormat | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_Minimal_ViewOptions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\password-protected.docx" | |
fileInfo.password = "password" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_OutputPath: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.output_path = "viewerdocs" | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_Project_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.mpp" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
projectManagementOptions = groupdocs_viewer_cloud.ProjectManagementOptions() | |
projectManagementOptions.page_size = "Unknown" | |
projectManagementOptions.time_unit = "Months" | |
projectManagementOptions.start_date = "2008/07/01" | |
projectManagementOptions.end_date = "2008/07/31" | |
renderOptions.project_management_options = projectManagementOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_Responsive_HTML: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\three-layouts.dwf" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.HtmlOptions() | |
renderOptions.is_responsive = True | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_SpreadsheetOptions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\with-hidden-rows-and-columns.xlsx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
spreadsheetOptions = groupdocs_viewer_cloud.SpreadsheetOptions() | |
spreadsheetOptions.paginate_sheets = True | |
spreadsheetOptions.count_rows_per_page = 5 | |
renderOptions.spreadsheet_options = spreadsheetOptions | |
viewOptions.render_options = renderOptions | |
renderOptions.spreadsheet_options = spreadsheetOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Create_View_With_StartPage_And_CountPages: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\four-pages.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
renderOptions.start_page_number = 2 | |
renderOptions.count_pages_to_render = 2 | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.CreateViewRequest(viewOptions) | |
response = api.create_view(request) | |
print("Expected response type is ViewResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Delete_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.DeleteFileRequest("viewerdocs1\\one-page.docx", Common_Utilities.myStorage) | |
api.delete_file(request) | |
print("Expected response type is Void: 'viewerdocs1/one-page.docx' deleted.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Delete_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.DeleteFolderRequest("viewerdocs\\viewerdocs1", Common_Utilities.myStorage, True) | |
api.delete_folder(request) | |
print("Expected response type is Void: 'viewerdocs/viewerdocs1' folder deleted recursively.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Delete_View_With_Default_ViewFormat: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_ViewApi_Instance() | |
try: | |
deleteViewOptions = groupdocs_viewer_cloud.DeleteViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\password-protected.docx" | |
fileInfo.password = "password" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
deleteViewOptions.file_info = fileInfo; | |
request = groupdocs_viewer_cloud.DeleteViewRequest(deleteViewOptions) | |
api.delete_view(request) | |
print("Expected response type is Void: View deleted with default View Format.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Download_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.DownloadFileRequest("viewerdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.download_file(request) | |
print("Expected response type is Stream: " + str(len(response))) | |
except groupdocs_viewer_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_viewer_cloud.FileApi.from_config(configuration) | |
request = groupdocs_viewer_cloud.DownloadFileRequest("viewer\\sample_mpp\\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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_All_Supported_Formats: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
# Retrieve supported file-formats | |
response = api.get_supported_file_formats() | |
# Print out supported file-formats | |
print("Supported file-formats:") | |
for fileformat in response.formats: | |
print('{0} ({1})'.format(fileformat.file_format, fileformat.extension)) | |
except groupdocs_viewer_cloud.ApiException as e: | |
print("Exception when calling get_supported_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Disc_Usage: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.GetDiscUsageRequest(Common_Utilities.myStorage) | |
response = api.get_disc_usage(request) | |
print("Expected response type is DiscUsage: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_File_Versions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.GetFileVersionsRequest("viewerdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.get_file_versions(request) | |
print("Expected response type is FileVersions: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Files_List: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.GetFilesListRequest("viewerdocs\\sample.docx", Common_Utilities.myStorage) | |
response = api.get_files_list(request) | |
print("Expected response type is FilesList: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_CAD_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\three-layouts.dwf" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
cadOptions = groupdocs_viewer_cloud.CadOptions() | |
cadOptions.scale_factor = 50 | |
renderOptions.cad_options = cadOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_HTML_View_Format: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.view_format = "HTML" | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_Image_View_Format: | |
@classmethod | |
def Run(self, viewFormat): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.docx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
viewOptions.view_format = viewFormat | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_Image_View_Options_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\three-layouts.dwf" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.ImageOptions() | |
renderOptions.extract_text = True | |
viewOptions.render_options = renderOptions | |
viewOptions.view_format = "PNG" | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_Minimal_ViewOptions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\password-protected.docx" | |
fileInfo.password = "password" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_Project_Options: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\sample.mpp" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
projectManagementOptions = groupdocs_viewer_cloud.ProjectManagementOptions() | |
projectManagementOptions.page_size = "Unknown" | |
projectManagementOptions.time_unit = "Months" | |
projectManagementOptions.start_date = "2008/07/01" | |
projectManagementOptions.end_date = "2008/07/31" | |
renderOptions.project_management_options = projectManagementOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Get_Info_With_SpreadsheetOptions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
viewOptions = groupdocs_viewer_cloud.ViewOptions() | |
fileInfo = groupdocs_viewer_cloud.FileInfo() | |
fileInfo.file_path = "viewerdocs\\with-hidden-rows-and-columns.xlsx" | |
fileInfo.password = "" | |
fileInfo.storage_name = Common_Utilities.myStorage | |
viewOptions.file_info = fileInfo; | |
renderOptions = groupdocs_viewer_cloud.RenderOptions() | |
spreadsheetOptions = groupdocs_viewer_cloud.SpreadsheetOptions() | |
spreadsheetOptions.paginate_sheets = True | |
spreadsheetOptions.count_rows_per_page = 5 | |
renderOptions.spreadsheet_options = spreadsheetOptions | |
viewOptions.render_options = renderOptions | |
request = groupdocs_viewer_cloud.GetInfoRequest(viewOptions) | |
response = api.get_info(request) | |
print("Expected response type is InfoResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Move_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.MoveFileRequest("viewerdocs\\one-page.docx", "viewerdocs1\\one-page.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_file(request) | |
print("Expected response type is Void: 'viewerdocs/one-page.docx' file moved to 'viewerdocs1/one-page.docx'.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Move_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.MoveFolderRequest("viewerdocs1", "viewerdocs1\\viewerdocs", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_folder(request) | |
print("Expected response type is Void: 'viewerdocs1' folder moved to 'viewerdocs/viewerdocs1'.") | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Object_Exists: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.ObjectExistsRequest("viewerdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.object_exists(request) | |
print("Expected response type is ObjectExist: " + str(response)) | |
except groupdocs_viewer_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 | |
api_instance = groupdocs_viewer_cloud.ViewApi.from_keys(client_id, client_secret) | |
view_options = groupdocs_viewer_cloud.ViewOptions() | |
view_options.file_info = groupdocs_viewer_cloud.FileInfo() | |
view_options.file_info.file_path = "sample.mpp" | |
view_options.view_format = "PDF" | |
view_options.render_options = groupdocs_viewer_cloud.PdfOptions() | |
request = groupdocs_viewer_cloud.CreateViewRequest(view_options) | |
response = api_instance.create_view(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
view_options.render_options.project_management_options = groupdocs_viewer_cloud.ProjectManagementOptions() | |
# Specify Start and End dates | |
view_options.render_options.project_management_options.start_date = "2008/06/01" | |
view_options.render_options.project_management_options.end_date = "2008/07/01" | |
# Adjust time unit | |
view_options.render_options.project_management_options.time_unit = "Days" |
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_viewer_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 = "https://api.groupdocs.cloud" # Put your Host URL here | |
Common_Utilities.app_sid = "XXXXX-XXXXX-XXXXX" | |
Common_Utilities.app_key = "XXXXXXXXXX" | |
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 Viewer_Python_Get_All_Supported_Formats...") | |
from Supported_File_Formats.Viewer_Python_Get_All_Supported_Formats import Viewer_Python_Get_All_Supported_Formats | |
Viewer_Python_Get_All_Supported_Formats.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Storage...") | |
# ########################################## | |
# print("* Executing Viewer_Python_Storage_Exist...") | |
# from Working_With_Storage.Viewer_Python_Storage_Exist import Viewer_Python_Storage_Exist | |
# Viewer_Python_Storage_Exist.Run() | |
# print("* Executing Viewer_Python_Object_Exists...") | |
# from Working_With_Storage.Viewer_Python_Object_Exists import Viewer_Python_Object_Exists | |
# Viewer_Python_Object_Exists.Run() | |
# print("* Executing Viewer_Python_Get_File_Versions...") | |
# from Working_With_Storage.Viewer_Python_Get_File_Versions import Viewer_Python_Get_File_Versions | |
# Viewer_Python_Get_File_Versions.Run() | |
# print("* Executing Viewer_Python_Get_Disc_Usage...") | |
# from Working_With_Storage.Viewer_Python_Get_Disc_Usage import Viewer_Python_Get_Disc_Usage | |
# Viewer_Python_Get_Disc_Usage.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Folder...") | |
# ########################################## | |
# print("* Executing Viewer_Python_Create_Folder...") | |
# from Working_With_Folder.Viewer_Python_Create_Folder import Viewer_Python_Create_Folder | |
# Viewer_Python_Create_Folder.Run() | |
# print("* Executing Viewer_Python_Copy_Folder...") | |
# from Working_With_Folder.Viewer_Python_Copy_Folder import Viewer_Python_Copy_Folder | |
# Viewer_Python_Copy_Folder.Run() | |
# print("* Executing Viewer_Python_Get_Files_List...") | |
# from Working_With_Folder.Viewer_Python_Get_Files_List import Viewer_Python_Get_Files_List | |
# Viewer_Python_Get_Files_List.Run() | |
# print("* Executing Viewer_Python_Move_Folder...") | |
# from Working_With_Folder.Viewer_Python_Move_Folder import Viewer_Python_Move_Folder | |
# Viewer_Python_Move_Folder.Run() | |
# print("* Executing Viewer_Python_Delete_Folder...") | |
# from Working_With_Folder.Viewer_Python_Delete_Folder import Viewer_Python_Delete_Folder | |
# Viewer_Python_Delete_Folder.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Files...") | |
# ########################################## | |
# print("* Executing Viewer_Python_Upload_File...") | |
# from Working_With_Files.Viewer_Python_Upload_File import Viewer_Python_Upload_File | |
# Viewer_Python_Upload_File.Run() | |
# print("* Executing Viewer_Python_Download_File...") | |
# from Working_With_Files.Viewer_Python_Download_File import Viewer_Python_Download_File | |
# Viewer_Python_Download_File.Run() | |
# print("* Executing Viewer_Python_Copy_File...") | |
# from Working_With_Files.Viewer_Python_Copy_File import Viewer_Python_Copy_File | |
# Viewer_Python_Copy_File.Run() | |
# print("* Executing Viewer_Python_Move_File...") | |
# from Working_With_Files.Viewer_Python_Move_File import Viewer_Python_Move_File | |
# Viewer_Python_Move_File.Run() | |
# print("* Executing Viewer_Python_Delete_File...") | |
# from Working_With_Files.Viewer_Python_Delete_File import Viewer_Python_Delete_File | |
# Viewer_Python_Delete_File.Run() | |
############################################################ | |
print("*** Executing Working_With_Document_Information...") | |
############################################################ | |
# print("* Executing Viewer_Python_Get_Info_With_Minimal_ViewOptions...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Minimal_ViewOptions import Viewer_Python_Get_Info_With_Minimal_ViewOptions | |
# Viewer_Python_Get_Info_With_Minimal_ViewOptions.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_CAD_Options...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_CAD_Options import Viewer_Python_Get_Info_With_CAD_Options | |
# Viewer_Python_Get_Info_With_CAD_Options.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_HTML_View_Format...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_HTML_View_Format import Viewer_Python_Get_Info_With_HTML_View_Format | |
# Viewer_Python_Get_Info_With_HTML_View_Format.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_Image_View_Format...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Image_View_Format import Viewer_Python_Get_Info_With_Image_View_Format | |
# Viewer_Python_Get_Info_With_Image_View_Format.Run("PNG") | |
# print("* Executing Viewer_Python_Get_Info_With_Image_View_Options_Options...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Image_View_Options_Options import Viewer_Python_Get_Info_With_Image_View_Options_Options | |
# Viewer_Python_Get_Info_With_Image_View_Options_Options.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_Project_Options...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Project_Options import Viewer_Python_Get_Info_With_Project_Options | |
# Viewer_Python_Get_Info_With_Project_Options.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_Render_Hidden_Pages...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Render_Hidden_Pages import Viewer_Python_Get_Info_With_Render_Hidden_Pages | |
# Viewer_Python_Get_Info_With_Render_Hidden_Pages.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_Spreadsheet_Render_Hidden_Rows_Option...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_Spreadsheet_Render_Hidden_Rows_Option import Viewer_Python_Get_Info_With_Spreadsheet_Render_Hidden_Rows_Option | |
# Viewer_Python_Get_Info_With_Spreadsheet_Render_Hidden_Rows_Option.Run() | |
# print("* Executing Viewer_Python_Get_Info_With_SpreadsheetOptions...") | |
# from Working_With_Document_Information.Viewer_Python_Get_Info_With_SpreadsheetOptions import Viewer_Python_Get_Info_With_SpreadsheetOptions | |
# Viewer_Python_Get_Info_With_SpreadsheetOptions.Run() | |
# ############################################ | |
# print("*** Executing Working_With_View..") | |
# ############################################ | |
# print("* Executing Viewer_Python_Create_View_With_Minimal_ViewOptions...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Minimal_ViewOptions import Viewer_Python_Create_View_With_Minimal_ViewOptions | |
# Viewer_Python_Create_View_With_Minimal_ViewOptions.Run() | |
# print("* Executing Viewer_Python_Create_View_With_CAD_Options...") | |
# from Working_With_View.Viewer_Python_Create_View_With_CAD_Options import Viewer_Python_Create_View_With_CAD_Options | |
# Viewer_Python_Create_View_With_CAD_Options.Run() | |
# print("* Executing Viewer_Python_Create_View_With_Fonts_Path_Options...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Fonts_Path_Options import Viewer_Python_Create_View_With_Fonts_Path_Options | |
# Viewer_Python_Create_View_With_Fonts_Path_Options.Run() | |
# print("* Executing Viewer_Python_Create_View_With_HTML_View_Format...") | |
# from Working_With_View.Viewer_Python_Create_View_With_HTML_View_Format import Viewer_Python_Create_View_With_HTML_View_Format | |
# Viewer_Python_Create_View_With_HTML_View_Format.Run() | |
# print("* Executing Viewer_Python_Create_View_With_HTML_ViewOptions...") | |
# from Working_With_View.Viewer_Python_Create_View_With_HTML_ViewOptions import Viewer_Python_Create_View_With_HTML_ViewOptions | |
# Viewer_Python_Create_View_With_HTML_ViewOptions.Run() | |
# print("* Executing Viewer_Python_Create_View_With_Image_View_Format...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Image_View_Format import Viewer_Python_Create_View_With_Image_View_Format | |
# Viewer_Python_Create_View_With_Image_View_Format.Run("PNG") | |
# print("* Executing Viewer_Python_Create_View_With_Project_Options...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Project_Options import Viewer_Python_Create_View_With_Project_Options | |
# Viewer_Python_Create_View_With_Project_Options.Run() | |
# print("* Executing Viewer_Python_Create_View_With_Render_Hidden_Pages...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Render_Hidden_Pages import Viewer_Python_Create_View_With_Render_Hidden_Pages | |
# Viewer_Python_Create_View_With_Render_Hidden_Pages.Run() | |
# print("* Executing Viewer_Python_Create_View_With_SpreadsheetOptions...") | |
# from Working_With_View.Viewer_Python_Create_View_With_SpreadsheetOptions import Viewer_Python_Create_View_With_SpreadsheetOptions | |
# Viewer_Python_Create_View_With_SpreadsheetOptions.Run() | |
# print("* Executing Viewer_Python_Create_View_With_Spreadsheet_Render_Hidden_Rows_Option...") | |
# from Working_With_View.Viewer_Python_Create_View_With_Spreadsheet_Render_Hidden_Rows_Option import Viewer_Python_Create_View_With_Spreadsheet_Render_Hidden_Rows_Option | |
# Viewer_Python_Create_View_With_Spreadsheet_Render_Hidden_Rows_Option.Run() | |
# print("* Executing Viewer_Python_Create_View_With_StartPage_And_CountPages...") | |
# from Working_With_View.Viewer_Python_Create_View_With_StartPage_And_CountPages import Viewer_Python_Create_View_With_StartPage_And_CountPages | |
# Viewer_Python_Create_View_With_StartPage_And_CountPages.Run() | |
# print("* Executing Viewer_Python_Delete_View_With_Default_ViewFormat...") | |
# from Working_With_View.Viewer_Python_Delete_View_With_Default_ViewFormat import Viewer_Python_Delete_View_With_Default_ViewFormat | |
# Viewer_Python_Delete_View_With_Default_ViewFormat.Run() | |
print("* Executing Viewer_Python_Create_View_With_Responsive_HTML...") | |
from Working_With_View.Viewer_Python_Create_View_With_Responsive_HTML import Viewer_Python_Create_View_With_Responsive_HTML | |
Viewer_Python_Create_View_With_Responsive_HTML.Run() | |
print("* Executing Viewer_Python_Create_View_With_OutputPath...") | |
from Working_With_View.Viewer_Python_Create_View_With_OutputPath import Viewer_Python_Create_View_With_OutputPath | |
Viewer_Python_Create_View_With_OutputPath.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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Storage_Exist: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.StorageExistsRequest(Common_Utilities.myStorage) | |
response = api.storage_exists(request) | |
print("Expected response type is StorageExist: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Viewer_Python_Upload_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_viewer_cloud.UploadFileRequest("viewerdocs\\one-page.docx", "D:\\ewspace\\GroupDocs.Viewer.Cloud.Python.Examples\\src\\Resources\\viewerdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.upload_file(request) | |
print("Expected response type is FilesUploadResult: " + str(response)) | |
except groupdocs_viewer_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_viewer_cloud.FileApi.from_config(configuration) | |
request = groupdocs_viewer_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_viewer_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_ViewApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_viewer_cloud.ViewApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_InfoApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_viewer_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_viewer_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_viewer_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_viewer_cloud.FileApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Upload_Test_Files(self): | |
dirName = "D:\\ewspace\\GroupDocs.Viewer.Cloud.Python.Examples\\src\\Resources\\viewerdocs\\" | |
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_viewer_cloud.ObjectExistsRequest(dirName + item) | |
fileExistsResponse = storageApi.object_exists(fileExistRequest) | |
if not fileExistsResponse.exists: | |
# file content uploading | |
putCreateRequest = groupdocs_viewer_cloud.UploadFileRequest('viewerdocs\\' + item, dirName + item) | |
fileApi.upload_file(putCreateRequest) | |
print("Uploaded missing file: "+ 'viewerdocs\\' + 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