GroupDocs.Conversion Cloud REST API allows to convert the supported document formats to Text Formats and returns the output document storage URL and also support to get result as a stream or Array of stream.
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.
usingSystem;usingSystem.Collections.Generic;usingGroupDocs.Conversion.Cloud.Sdk.Api;usingGroupDocs.Conversion.Cloud.Sdk.Client;usingGroupDocs.Conversion.Cloud.Sdk.Model;usingGroupDocs.Conversion.Cloud.Sdk.Model.Requests;namespaceGroupDocs.Conversion.Cloud.Examples.CSharp{// Convert to Text with load and save optionsclassConvert_To_Text{publicstaticvoidRun(){varconfiguration=newConfiguration(Common.MyAppSid,Common.MyAppKey);varapiInstance=newConvertApi(configuration);try{// convert settingsvarsettings=newConvertSettings{StorageName=Common.MyStorage,FilePath="conversions/sample.docx",Format="txt",LoadOptions=newDocxLoadOptions(){Password="",HideWordTrackedChanges=true,DefaultFont="Arial"},ConvertOptions=newTxtConvertOptions(){FromPage=1,PagesCount=2},OutputPath="converted/totext"};// convert to specified formatList<StoredConvertedResult>response=apiInstance.ConvertDocument(newConvertDocumentRequest(settings));Console.WriteLine("Document conveted successfully: "+response[0].Url);}catch(Exceptione){Console.WriteLine("Exception when calling ConvertApi: "+e.Message);}}}}
<?phpinclude(dirname(__DIR__).'\CommonUtils.php');$convertApi=CommonUtils::GetConvertApiInstance();try{$settings=newGroupDocs\Conversion\Model\ConvertSettings();$settings->setStorageName(CommonUtils::$MyStorage);$settings->setFilePath("conversions\\password-protected.docx");$settings->setFormat("txt");$loadOptions=newGroupDocs\Conversion\Model\DocxLoadOptions();$loadOptions->setPassword("password");$loadOptions->setHideWordTrackedChanges(true);$loadOptions->setDefaultFont("Arial");$settings->setLoadOptions($loadOptions);$convertOptions=newGroupDocs\Conversion\Model\TxtConvertOptions();$convertOptions->setFromPage(1);$convertOptions->setPagesCount(2);$settings->setConvertOptions($convertOptions);$settings->setOutputPath("converted\\totext");$request=newGroupDocs\Conversion\Model\Requests\ConvertDocumentRequest($settings);$response=$convertApi->convertDocument($request);echo"Document converted successfully: ",$response[0]->getUrl();}catch(Exception$e){echo"Something went wrong: ",$e->getMessage(),"<br />";PHP_EOL;}?>
packageexamples.Working_With_Conversions;importcom.groupdocs.cloud.conversion.api.*;importcom.groupdocs.cloud.conversion.client.ApiException;importcom.groupdocs.cloud.conversion.model.*;importcom.groupdocs.cloud.conversion.model.requests.*;importexamples.Utils;importjava.util.List;publicclassConversion_Java_Convert_To_Text{publicstaticvoidmain(String[]args){ConvertApiapiInstance=newConvertApi(Utils.AppSID,Utils.AppKey);try{ConvertSettingssettings=newConvertSettings();settings.setStorageName(Utils.MYStorage);settings.setFilePath("conversions\\sample.docx");settings.setFormat("txt");DocxLoadOptionsloadOptions=newDocxLoadOptions();loadOptions.setPassword("");loadOptions.setHideWordTrackedChanges(true);loadOptions.setDefaultFont("Arial");settings.setLoadOptions(loadOptions);TxtConvertOptionsconvertOptions=newTxtConvertOptions();convertOptions.setFromPage(1);convertOptions.setPagesCount(2);settings.setConvertOptions(convertOptions);settings.setOutputPath("converted\\totext");// convert to specified format
List<StoredConvertedResult>response=apiInstance.convertDocument(newConvertDocumentRequest(convertSettings));System.out.println("Document converted successfully: "+response.size());}catch(ApiExceptione){System.err.println("Exception while calling ConvertApi:");e.printStackTrace();}}}
# Load the gemrequire'groupdocs_conversion_cloud'require'common_utilities/Utils.rb'classWorking_With_Conversionsdefself.Conversion_Ruby_Convert_To_Text()# Getting instance of the APIapi=Common_Utilities.Get_ConvertApi_Instance()$settings=GroupDocsConversionCloud::ConvertSettings.new()$settings.storage_name=$myStorage;$settings.file_path="conversions/sample.docx"$settings.format="txt"$loadOptions=GroupDocsConversionCloud::DocxLoadOptions.new()$loadOptions.hide_word_tracked_changes=true$loadOptions.default_font="Arial"$settings.load_options=$loadOptions$convertOptions=GroupDocsConversionCloud::TxtConvertOptions.new()$convertOptions.from_page=1$convertOptions.pages_count=1$settings.convert_options=$convertOptions$settings.output_path="converted/totext"$request=GroupDocsConversionCloud::ConvertDocumentRequest.new($settings)$response=api.convert_document($request)puts("Document converted successfully: "+($response).to_s)endend
# Import modulesimportgroupdocs_conversion_cloudfromCommon_Utilities.UtilsimportCommon_UtilitiesclassConversion_Python_Convert_To_Text:@classmethoddefRun(self):# Create instance of the APIapi=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=TrueloadOptions.default_font="Arial"settings.load_options=loadOptions;convertOptions=groupdocs_conversion_cloud.TxtConvertOptions()convertOptions.from_page=1convertOptions.pages_count=1settings.convert_options=convertOptionssettings.output_path="converted\\totxt"request=groupdocs_conversion_cloud.ConvertDocumentRequest(settings)response=api.convert_document(request)print("Document converted successfully: "+str(response))exceptgroupdocs_conversion_cloud.ApiExceptionase:print("Exception while calling API: {0}".format(e.message))
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go-samples
packageconvertimport("fmt""os""github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go-samples/config""github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go/models")funcConvertToTxt(){settings:=models.ConvertSettings{Format:"txt",FilePath:"WordProcessing/four-pages.docx",OutputPath:"converted",}result,_,err:=config.Client.ConvertApi.ConvertDocument(config.Ctx,settings)iferr!=nil{fmt.Printf("ConvertToTxt error: %v\n",err)return}}
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingGroupDocs.Conversion.Cloud.Sdk.Api;usingGroupDocs.Conversion.Cloud.Sdk.Client;usingGroupDocs.Conversion.Cloud.Sdk.Model;usingGroupDocs.Conversion.Cloud.Sdk.Model.Requests;namespaceGroupDocs.Conversion.Cloud.Examples.CSharp{// Convert to Text with load and save options with output as iostreamclassConvert_To_Text_Stream{publicstaticvoidRun(){varconfiguration=newConfiguration(Common.MyAppSid,Common.MyAppKey);varapiInstance=newConvertApi(configuration);try{// convert settingsvarsettings=newConvertSettings{StorageName=Common.MyStorage,FilePath="conversions/sample.docx",Format="txt",LoadOptions=newDocxLoadOptions(){Password="",HideWordTrackedChanges=true,DefaultFont="Arial"},ConvertOptions=newTxtConvertOptions(){FromPage=1,PagesCount=2},OutputPath=null// set OutputPath as null will result the output as document IOStream};// convert to specified formatStreamresponse=apiInstance.ConvertDocumentDownload(newConvertDocumentRequest(settings));Console.WriteLine("Document conveted successfully: "+response.Length.ToString());}catch(Exceptione){Console.WriteLine("Exception when calling ConvertApi: "+e.Message);}}}}
<?phpinclude(dirname(__DIR__).'\CommonUtils.php');$convertApi=CommonUtils::GetConvertApiInstance();try{$settings=newGroupDocs\Conversion\Model\ConvertSettings();$settings->setStorageName(CommonUtils::$MyStorage);$settings->setFilePath("conversions\\password-protected.docx");$settings->setFormat("txt");$loadOptions=newGroupDocs\Conversion\Model\DocxLoadOptions();$loadOptions->setPassword("password");$loadOptions->setHideWordTrackedChanges(true);$loadOptions->setDefaultFont("Arial");$settings->setLoadOptions($loadOptions);$convertOptions=newGroupDocs\Conversion\Model\TxtConvertOptions();$convertOptions->setFromPage(1);$convertOptions->setPagesCount(2);$settings->setConvertOptions($convertOptions);// set OutputPath as empty will result the output as document Stream'
$settings->setOutputPath("");$request=newGroupDocs\Conversion\Model\Requests\ConvertDocumentRequest($settings);$response=$convertApi->convertDocumentDownload($request);echo"Document converted successfully: Document Size: ",$response->getSize();}catch(Exception$e){echo"Something went wrong: ",$e->getMessage(),"<br />";PHP_EOL;}?>
packageexamples.Working_With_Conversions;importcom.groupdocs.cloud.conversion.api.*;importcom.groupdocs.cloud.conversion.client.ApiException;importcom.groupdocs.cloud.conversion.model.*;importcom.groupdocs.cloud.conversion.model.requests.*;importexamples.Utils;importjava.util.stream.*;publicclassConversion_Java_Convert_To_Text_Stream{publicstaticvoidmain(String[]args){ConvertApiapiInstance=newConvertApi(Utils.AppSID,Utils.AppKey);try{ConvertSettingssettings=newConvertSettings();settings.setStorageName(Utils.MYStorage);settings.setFilePath("conversions\\sample.docx");settings.setFormat("txt");DocxLoadOptionsloadOptions=newDocxLoadOptions();loadOptions.setPassword("");loadOptions.setHideWordTrackedChanges(true);loadOptions.setDefaultFont("Arial");settings.setLoadOptions(loadOptions);TxtConvertOptionsconvertOptions=newTxtConvertOptions();convertOptions.setFromPage(1);convertOptions.setPagesCount(2);settings.setConvertOptions(convertOptions);// set OutputPath as empty will result the output as document IOStream
settings.setOutputPath("");// convert to specified format
Streamresponse=apiInstance.convertDocument(newConvertDocumentRequest(convertSettings));System.out.println("Document converted successfully: "+response);}catch(ApiExceptione){System.err.println("Exception while calling ConvertApi:");e.printStackTrace();}}}
# Load the gemrequire'groupdocs_conversion_cloud'require'common_utilities/Utils.rb'classWorking_With_Conversionsdefself.Conversion_Ruby_Convert_To_Text_Stream()# Getting instance of the APIapi=Common_Utilities.Get_ConvertApi_Instance()$settings=GroupDocsConversionCloud::ConvertSettings.new()$settings.storage_name=$myStorage;$settings.file_path="conversions/sample.docx"$settings.format="txt"$loadOptions=GroupDocsConversionCloud::DocxLoadOptions.new()$loadOptions.hide_word_tracked_changes=true$loadOptions.default_font="Arial"$settings.load_options=$loadOptions$convertOptions=GroupDocsConversionCloud::TxtConvertOptions.new()$convertOptions.from_page=1$convertOptions.pages_count=1$settings.convert_options=$convertOptions# leave OutputPath will result the output as document IOStream$request=GroupDocsConversionCloud::ConvertDocumentRequest.new($settings)$response=api.convert_document($request)puts("Document converted successfully: "+($response.length).to_s)endend
"use strict";classConversion_Node_Convert_To_Text_Stream{staticRun(){varsettings=newgroupdocs_conversion_cloud_1.ConvertSettings();settings.storageName=myStorage;settings.filePath="conversions/sample.docx";settings.format="txt";varloadOptions=newgroupdocs_conversion_cloud_1.DocxLoadOptions();loadOptions.hideWordTrackedChanges=true;loadOptions.defaultFont="Arial";settings.loadOptions=loadOptions;varconvertOptions=newgroupdocs_conversion_cloud_1.TxtConvertOptions();convertOptions.fromPage=1;convertOptions.pagesCount=1;settings.convertOptions=convertOptions;settings.outputPath=null;// set OutputPath as null will result the output as document IOStream
varrequest=newgroupdocs_conversion_cloud_1.ConvertDocumentRequest(settings);convertApi.convertDocumentDownload(request).then(function(response){console.log("Document converted successfully: "+response.length);}).catch(function(error){console.log("Error: "+error.message);});}}module.exports=Conversion_Node_Convert_To_Text_Stream;
# Import modulesimportgroupdocs_conversion_cloudfromCommon_Utilities.UtilsimportCommon_UtilitiesclassConversion_Python_Convert_To_Text_Stream:@classmethoddefRun(self):# Create instance of the APIapi=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=TrueloadOptions.default_font="Arial"settings.load_options=loadOptions;convertOptions=groupdocs_conversion_cloud.TxtConvertOptions()convertOptions.from_page=1convertOptions.pages_count=1settings.convert_options=convertOptionssettings.output_path=None# leave OutputPath will result the output as document IOStreamrequest=groupdocs_conversion_cloud.ConvertDocumentRequest(settings)response=api.convert_document_download(request)print("Document converted successfully: "+str(len(response)))exceptgroupdocs_conversion_cloud.ApiExceptionase:print("Exception while calling API: {0}".format(e.message))
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go-samples
packageconvertimport("fmt""os""github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go-samples/config""github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go/models")funcConvertToTxt(){settings:=models.ConvertSettings{Format:"txt",FilePath:"WordProcessing/four-pages.docx",}result,_,err:=config.Client.ConvertApi.ConvertDocument(config.Ctx,settings)iferr!=nil{fmt.Printf("ConvertToTxt error: %v\n",err)return}// Get file info
fileInfo,errInfo:=result.Stat()iferrInfo!=nil{t.Error(errInfo)}// Get the size of the file
fileSize:=fileInfo.Size()}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.