|
// For complete examples and data files, please go to https://github.com/aspose-words-cloud/aspose-words-cloud-python |
|
// Get client credentials from https://dashboard.aspose.cloud/ |
|
|
|
def wordtotiff(): |
|
try: |
|
# create an instance of WordsApi |
|
words_api = WordsApi("bbf94a2c-6d7e-4020-b4d2-b9809741374e","1c9379bb7d701c26cc87e741a29987bb") |
|
|
|
# Name of input word document |
|
inputFileName = 'test_multi_pages.docx' |
|
|
|
# Upload source Word document to Cloud Storage |
|
words_api.upload_file(asposewordscloud.models.requests.UploadFileRequest(open('C:\\Users\\shahbnay\\Downloads\\'+inputFileName, 'rb'), "", None)) |
|
|
|
# Create an object for Document conversion |
|
# request = asposewordscloud.models.requests.GetDocumentWithFormatRequest(inputFileName, "TIFF", None, None, None, |
|
# None, resultantFile, None) |
|
#request_save_options = asposewordscloud.TiffSaveOptionsData(file_name=inputFileName) |
|
request_save_options = {"FileName":inputFileName, |
|
"SaveFormat":"tiff", |
|
"AllowEmbeddingPostScriptFonts":True, |
|
"DmlRenderingMode":"Fallback", |
|
"DmlEffectsRenderingMode":"Simplified", |
|
"ImlRenderingMode": "Fallback", |
|
"ZipOutput": False, |
|
"UpdateLastSavedTimeProperty": True, |
|
"UpdateSdtContent": True, |
|
"UpdateFields": True, |
|
"Dml3DEffectsRenderingMode": "Basic", |
|
"UpdateCreatedTimeProperty": True, |
|
"UpdateLastPrintedProperty": True, |
|
"FlatOpcXmlMappingOnly": True, |
|
"ColorMode": "Normal", |
|
"JpegQuality": 100, |
|
"MetafileRenderingOptions": { |
|
"EmfPlusDualRenderingMode": "EmfPlusWithFallback", |
|
"EmulateRasterOperations": True, |
|
"RenderingMode": "VectorWithFallback", |
|
"UseEmfEmbeddedToWmf": True, |
|
"ScaleWmfFontsToMetafileSize": True |
|
}, |
|
"NumeralFormat": "European", |
|
"OptimizeOutput": True, |
|
"PageCount": 1, |
|
"PageIndex": 1, |
|
"HorizontalResolution": 800, |
|
"ImageBrightness": 0, |
|
"ImageColorMode": "None", |
|
"ImageContrast": 0, |
|
"PixelFormat": "Format16BppRgb555", |
|
"Resolution": 800, |
|
"Scale": 1.0, |
|
"UseAntiAliasing": True, |
|
"UseGdiEmfRenderer": True, |
|
"UseHighQualityRendering": True, |
|
"VerticalResolution": 400, |
|
"ThresholdForFloydSteinbergDithering": 0, |
|
"TiffBinarizationMethod": "Threshold", |
|
"TiffCompression": "None" |
|
} |
|
# initiate Word to JPEG conversion operation |
|
#result = words_api.get_document_with_format(request) |
|
|
|
result = words_api.save_as_tiff(name=inputFileName,save_options=request_save_options) |
|
# print message in console (optional) |
|
print('Conversion process completed successfully !') |
|
except Api as e: |
|
print("Exception while Converting Word to TIFF Document using Aspose.Words Cloud Api: {0}".format(e)) |