Get Images of Result Document
Leave feedback
On this page
NoteNote: The features listed in this page are working only with GroupDocs.Comparison Cloud V1
You can compare documents and can get the result document images path by providing the JsonRequest Object data in request body.
The following GroupDocs.Comparison Cloud REST API resource has been used to get images of result document.
curl -v "https://api.groupdocs.cloud/v1.0/comparison/compareDocuments/images?outFolder#comparisons%2FoutputImages&appsid#XXXX&signature#XXX-XX"
-H "Content-Type: application/json"
-X POST -d "{'sourceFile':{'folder':'comparisons','name':'source.docx','password':''},'targetFiles':[{'folder':'comparisons','name':'target.docx','password':''}],'settings
':{'generateSummaryPage':true,'showDeletedContent':true,'styleChangeDetection':true,'insertedItemsStyle':{'color':'Blue','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'deletedItemsStyle':{'color':'Red','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'styleChangedItemsStyle':{'color':'Green','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'wordsSeparatorChars':[],'detailLevel':'Low','useFramesForDelInsElements':false,'calculateComponentCoordinates':false,'markDeletedInsertedContentDeep':false},'changes':[{'id':0,'action':'Reject'},{'id':1,'action':'Reject'}]}"
[
{
"href": "https://api.groupdocs.cloud/storage/file/comparisons/outputImages/0.jpg",
"rel": "self",
"type": null,
"title": null
},
{
"href": "https://api.groupdocs.cloud/storage/file/comparisons/outputImages/1.jpg",
"rel": "self",
"type": null,
"title": null
},
{
"href": "https://api.groupdocs.cloud/storage/file/comparisons/outputImages/2.jpg",
"rel": "self",
"type": null,
"title": null
},
{
"href": "https://api.groupdocs.cloud/storage/file/comparisons/outputImages/3.jpg",
"rel": "self",
"type": null,
"title": null
}
]
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.
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", | |
AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
}; | |
// Initiate API object | |
var apiInstance = new ComparisonApi(configuration); | |
try | |
{ | |
// Comparison Request | |
ComparisonRequest comparisonRequest = new ComparisonRequest() | |
{ | |
// Comparison Request Settings | |
Settings = new ComparisonRequestSettings() | |
{ | |
GenerateSummaryPage = true, | |
ShowDeletedContent = true, | |
StyleChangeDetection = true, | |
UseFramesForDelInsElements = false, | |
DetailLevel = "Low", | |
DeletedItemsStyle = new StyleSettingsValues() | |
{ | |
BeginSeparatorString = "", | |
EndSeparatorString = "", | |
Color = new Color().Red | |
}, | |
InsertedItemsStyle = new StyleSettingsValues() | |
{ | |
BeginSeparatorString = "", | |
EndSeparatorString = "", | |
Color = new Color().Blue | |
}, | |
StyleChangedItemsStyle = new StyleSettingsValues() | |
{ | |
BeginSeparatorString = "", | |
EndSeparatorString = "", | |
Color = new Color().Green | |
}, | |
CalculateComponentCoordinates = false, | |
CloneMetadata = "Source", | |
MarkDeletedInsertedContentDeep = false, | |
MetaData = new ComparisonMetadataValues() | |
{ | |
Author = "GroupDocs", | |
Company = "GroupDocs", | |
LastSaveBy = "GroupDocs" | |
}, | |
Password = "", | |
PasswordSaveOption = "" | |
}, | |
// Source file | |
SourceFile = new ComparisonFileInfo() | |
{ | |
Folder = "comparisons", | |
Name = "source.docx", | |
Password = "" | |
} | |
}; | |
List<ComparisonFileInfo> targets = new List<ComparisonFileInfo>(); | |
// Target file | |
targets.Add(new ComparisonFileInfo() | |
{ | |
Folder = "comparisons", | |
Name = "target.docx", | |
Password = "" | |
}); | |
// Target file - single or multiple target files are allowed. | |
comparisonRequest.TargetFiles = targets.ToArray(); | |
// API call for response. | |
var response = apiInstance.ComparisonImages(new Model.Requests.ComparisonImagesRequest() { Request = comparisonRequest, OutFolder = "comparisons" }); | |
Console.WriteLine(string.Format("{0}: {1}", "response is List<Link>", response.Count.ToString())); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ComparisonApi.ComparisonImages: " + e.Message); | |
} |
<?php | |
require_once('C:\xampp\htdocs\groupdocs-comparison-cloud-php-master\vendor\autoload.php'); | |
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
$configuration = new GroupDocs\Comparison\Configuration(); | |
$configuration->setAppSid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); | |
$configuration->setAppKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); | |
$apiInstance = new GroupDocs\Comparison\ComparisonApi($configuration); | |
try { | |
$targetArray = array(); | |
$targetNames = array('target.docx'); | |
foreach ($targetNames as $targetName){ | |
array_push($targetArray,new GroupDocs\Comparison\Model\ComparisonFileInfo( | |
[ | |
'folder' => 'comparisons', | |
'name' => $targetName, | |
'password' => '' | |
] | |
)); | |
} | |
$request = new GroupDocs\Comparison\Model\Requests\ComparisonImagesRequest(new GroupDocs\Comparison\Model\ComparisonRequest([ | |
'sourceFile'=>new GroupDocs\Comparison\Model\ComparisonFileInfo( | |
[ | |
'folder' => 'comparisons', | |
'name' => 'source.docx', | |
'password' => '' | |
] | |
), | |
'targetFiles'=> $targetArray, | |
'settings'=> new GroupDocs\Comparison\Model\ComparisonRequestSettings( | |
[ | |
'generateSummaryPage'=>true, | |
'showDeletedContent'=>true, | |
'styleChangeDetection'=>true, | |
'insertedItemsStyle' => new GroupDocs\Comparison\Model\StyleSettingsValues( | |
[ | |
'color' => new GroupDocs\Comparison\Model\Color([ | |
'blue' | |
]), | |
'beginSeparatorString' => '', | |
'endSeparatorString' => '' | |
] | |
), | |
'deletedItemsStyle' => new GroupDocs\Comparison\Model\StyleSettingsValues( | |
[ | |
'color' => new GroupDocs\Comparison\Model\Color([ | |
'red' | |
]), | |
'beginSeparatorString' => '', | |
'endSeparatorString' => '' | |
] | |
), | |
'styleChangedItemsStyle' => new GroupDocs\Comparison\Model\StyleSettingsValues( | |
[ | |
'color' => new GroupDocs\Comparison\Model\Color([ | |
'green' | |
]), | |
'beginSeparatorString' => '', | |
'endSeparatorString' => '' | |
] | |
), | |
'markDeletedInsertedContentDeep'=>true, | |
'calculateComponentCoordinates'=>true, | |
'useFramesForDelInsElements'=>true, | |
'wordsSeparatorChars' => array(), | |
'metaData' => new GroupDocs\Comparison\Model\ComparisonMetadataValues( | |
), | |
'cloneMetadata' => "Source", | |
'passwordSaveOption' => "User", | |
'password'=>"", | |
'detailLevel' => "Low", | |
] | |
), | |
'changes'=>array(new GroupDocs\Comparison\Model\ComparisonChange([ | |
'id' => 0, | |
'action' => 'Accept' | |
])) | |
]), | |
'comparisons/result.docx' | |
); | |
$response = $apiInstance->comparisonImages($request); | |
echo "Response: ", count($response); | |
} catch (Exception $e) { | |
echo "Error message: ", $e->getMessage(), "\n"; | |
PHP_EOL; | |
} | |
?> |
# TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java | |
/** | |
* Returns images of document with the result of comparison | |
* | |
* @throws ApiException if the Api call fails | |
*/ | |
String outPath = "result.docx", | |
sourceName = "source.docx", | |
targetName = "target.docx"; | |
StorageApi storageApi = Utils.getStorageApiInstance(); | |
// Upload files to Cloud Storage | |
File file = new File("src/main/resources/" + sourceName); | |
ResponseMessage storageresponse = storageApi.PutCreate("comparison/" + sourceName, null, null, file); | |
file = new File("src/main/resources/" + targetName); | |
storageresponse = storageApi.PutCreate("comparison/" + targetName, null, null, file); | |
ComparisonApi comparisonApi = Utils.getComparisonApiInstance(); | |
ComparisonImagesRequest request = new ComparisonImagesRequest(); | |
request.setRequest(GetComparisonRequest(sourceName, targetName)); | |
request.setOutFolder(outPath); | |
List<Link> response = comparisonApi.comparisonImages(request); | |
for (Link link : response) { | |
System.out.println(link.getHref()); | |
} |
# TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-ruby | |
# Returns images of document with the result of comparison | |
# throws ApiException if the Api call fails | |
def comparison_images | |
@config = GroupDocsComparisonCloud::Configuration.new(Utils::APP_SID, Utils::APP_KEY) | |
@config.api_base_url = Utils::API_BASE_URL | |
@sourcefile = "source.docx" | |
@targetfile = "target.docx" | |
@outputfile= "result.docx" | |
# Upload file to Cloud Storage | |
upload_file(@sourcefile) | |
upload_file(@targetfile) | |
# Returns images of document with the result of comparison | |
@comparison_api = GroupDocsComparisonCloud::ComparisonApi.from_config(@config) | |
request = GroupDocsComparisonCloud::ComparisonImagesRequest.new(GetComparisonRequest(@sourcefile, @targetfile),@outputfile) | |
response = @comparison_api.comparison_images(request) | |
puts response | |
puts 'completed' | |
end | |
# Upload file to Cloud Storage | |
def upload_file(file_name) | |
@conf = GroupDocsStorageCloud::Configuration.new | |
@conf.api_key['app_sid'] = Utils::APP_SID | |
@conf.api_key['api_key'] = Utils::APP_KEY | |
@conf.host = Utils::API_BASE_URL | |
@api_client = GroupDocsStorageCloud::ApiClient.new @conf | |
@storage_api = GroupDocsStorageCloud::StorageApi.new @api_client | |
file = File.open("../resources/"+file_name,"rb").read | |
version_id = nil | |
storage = nil | |
request = GroupDocsStorageCloud::PutCreateRequest.new(file_name, file, version_id, storage) | |
@storage_api.put_create(request) | |
end | |
def GetComparisonRequest(sourceName,*targetsNames) | |
request = GroupDocsComparisonCloud::ComparisonRequest.new; | |
setting = GroupDocsComparisonCloud::ComparisonRequestSettings.new; | |
setting.generate_summary_page = true; | |
setting.show_deleted_content = true; | |
setting.style_change_detection = true; | |
setting.use_frames_for_del_ins_elements = false; | |
setting.detail_level = "Low"; | |
deletedItemStyle = GroupDocsComparisonCloud::StyleSettingsValues.new; | |
deletedItemStyle.begin_separator_string = ""; | |
deletedItemStyle.end_separator_string = ""; | |
deletedItemStyle.color = GroupDocsComparisonCloud::Color.new.red; | |
setting.deleted_items_style = deletedItemStyle; | |
insertedItemStyle = GroupDocsComparisonCloud::StyleSettingsValues.new; | |
insertedItemStyle.begin_separator_string = ""; | |
insertedItemStyle.end_separator_string = ""; | |
insertedItemStyle.color = GroupDocsComparisonCloud::Color.new.blue; | |
setting.inserted_items_style = insertedItemStyle; | |
styleChangeItemStyle = GroupDocsComparisonCloud::StyleSettingsValues.new; | |
styleChangeItemStyle.begin_separator_string= ""; | |
styleChangeItemStyle.end_separator_string = ""; | |
styleChangeItemStyle.color = GroupDocsComparisonCloud::Color.new.green; | |
setting.style_changed_items_style = styleChangeItemStyle; | |
setting.calculate_component_coordinates = false; | |
setting.clone_metadata = "Source"; | |
setting.mark_deleted_inserted_content_deep = false; | |
setting.meta_data = nil; | |
setting.password = "1111"; | |
setting.password_save_option = "User"; | |
request.settings = setting; | |
sourseFile = GroupDocsComparisonCloud::ComparisonFileInfo.new; | |
sourseFile.folder = ""; | |
sourseFile.password = ""; | |
sourseFile.name = sourceName; | |
request.source_file = sourseFile; | |
targets = Array.new; | |
targetsNames.each do |targetName| | |
changeInfo = GroupDocsComparisonCloud::ComparisonFileInfo.new; | |
changeInfo.name = targetName; | |
changeInfo.folder = ""; | |
changeInfo.password = ""; | |
targets.push(changeInfo); | |
end | |
request.target_files = targets; | |
comparisonChanges = Array.new(2); | |
comparisonChanges[0] = GroupDocsComparisonCloud::ComparisonChange.new; | |
comparisonChanges[0].id = 0; | |
comparisonChanges[0].action = "Accept"; | |
comparisonChanges[1] = GroupDocsComparisonCloud::ComparisonChange.new; | |
comparisonChanges[1].id = 1; | |
comparisonChanges[1].action = "Reject"; | |
request.changes = comparisonChanges; | |
return request; | |
end |
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.