From 00cf0d4b51e0a35eb846c0750cbd0fbac1b94eba Mon Sep 17 00:00:00 2001 From: Muhammad Muqarrab Date: Fri, 9 May 2025 12:49:56 +0500 Subject: [PATCH] Upload Comparison tutorials --- .github/workflows/comparison-production.yml | 69 +++ .github/workflows/comparison-staging.yml | 69 +++ config/comparison/_default/config.toml | 150 +++++++ config/comparison/production/config.toml | 9 + config/comparison/staging/config.toml | 8 + content/comparison/english/_index.md | 77 ++++ .../advanced-data-structures/_index.md | 57 +++ .../applyrevisionsoptions/_index.md | 142 +++++++ .../changeinfo/_index.md | 158 +++++++ .../comparisonoptions/_index.md | 156 +++++++ .../diagrammastersetting/_index.md | 107 +++++ .../fileinfo/_index.md | 111 +++++ .../advanced-data-structures/format/_index.md | 92 ++++ .../itemsstyle/_index.md | 111 +++++ .../settings/_index.md | 239 +++++++++++ .../english/advanced-features/_index.md | 71 ++++ .../accept-all-revisions/_index.md | 257 +++++++++++ .../accept-reject-document-changes/_index.md | 371 ++++++++++++++++ .../accept-reject-revisions/_index.md | 377 +++++++++++++++++ .../compare-multiple-documents/_index.md | 222 ++++++++++ .../_index.md | 269 ++++++++++++ .../compare-password-protected/_index.md | 203 +++++++++ .../compare-sensitivity/_index.md | 226 ++++++++++ .../customize-changes-styles/_index.md | 275 ++++++++++++ .../get-changes-coordinates/_index.md | 274 ++++++++++++ .../get-list-of-changes/_index.md | 294 +++++++++++++ .../get-list-of-revisions/_index.md | 275 ++++++++++++ .../reject-all-revisions/_index.md | 260 ++++++++++++ .../_index.md | 328 ++++++++++++++ .../english/getting-started/_index.md | 40 ++ .../compare-documents/_index.md | 370 ++++++++++++++++ .../compare-pdf-files/_index.md | 372 ++++++++++++++++ .../create-document-preview/_index.md | 400 ++++++++++++++++++ .../create-document-preview-tutorial.md | 313 ++++++++++++++ .../get-document-information/_index.md | 288 +++++++++++++ .../get-document-information-tutorial.md | 292 +++++++++++++ .../get-supported-file-formats/_index.md | 251 +++++++++++ .../get-supported-file-formats-tutorial.md | 255 +++++++++++ content/home/english/_index.md | 2 +- 39 files changed, 7839 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/comparison-production.yml create mode 100644 .github/workflows/comparison-staging.yml create mode 100644 config/comparison/_default/config.toml create mode 100644 config/comparison/production/config.toml create mode 100644 config/comparison/staging/config.toml create mode 100644 content/comparison/english/_index.md create mode 100644 content/comparison/english/advanced-data-structures/_index.md create mode 100644 content/comparison/english/advanced-data-structures/applyrevisionsoptions/_index.md create mode 100644 content/comparison/english/advanced-data-structures/changeinfo/_index.md create mode 100644 content/comparison/english/advanced-data-structures/comparisonoptions/_index.md create mode 100644 content/comparison/english/advanced-data-structures/diagrammastersetting/_index.md create mode 100644 content/comparison/english/advanced-data-structures/fileinfo/_index.md create mode 100644 content/comparison/english/advanced-data-structures/format/_index.md create mode 100644 content/comparison/english/advanced-data-structures/itemsstyle/_index.md create mode 100644 content/comparison/english/advanced-data-structures/settings/_index.md create mode 100644 content/comparison/english/advanced-features/_index.md create mode 100644 content/comparison/english/advanced-features/accept-all-revisions/_index.md create mode 100644 content/comparison/english/advanced-features/accept-reject-document-changes/_index.md create mode 100644 content/comparison/english/advanced-features/accept-reject-revisions/_index.md create mode 100644 content/comparison/english/advanced-features/compare-multiple-documents/_index.md create mode 100644 content/comparison/english/advanced-features/compare-multiple-password-protected/_index.md create mode 100644 content/comparison/english/advanced-features/compare-password-protected/_index.md create mode 100644 content/comparison/english/advanced-features/compare-sensitivity/_index.md create mode 100644 content/comparison/english/advanced-features/customize-changes-styles/_index.md create mode 100644 content/comparison/english/advanced-features/get-changes-coordinates/_index.md create mode 100644 content/comparison/english/advanced-features/get-list-of-changes/_index.md create mode 100644 content/comparison/english/advanced-features/get-list-of-revisions/_index.md create mode 100644 content/comparison/english/advanced-features/reject-all-revisions/_index.md create mode 100644 content/comparison/english/advanced-features/set-password-for-resultant-document/_index.md create mode 100644 content/comparison/english/getting-started/_index.md create mode 100644 content/comparison/english/getting-started/compare-documents/_index.md create mode 100644 content/comparison/english/getting-started/compare-pdf-files/_index.md create mode 100644 content/comparison/english/getting-started/create-document-preview/_index.md create mode 100644 content/comparison/english/getting-started/create-document-preview/create-document-preview-tutorial.md create mode 100644 content/comparison/english/getting-started/get-document-information/_index.md create mode 100644 content/comparison/english/getting-started/get-document-information/get-document-information-tutorial.md create mode 100644 content/comparison/english/getting-started/get-supported-file-formats/_index.md create mode 100644 content/comparison/english/getting-started/get-supported-file-formats/get-supported-file-formats-tutorial.md diff --git a/.github/workflows/comparison-production.yml b/.github/workflows/comparison-production.yml new file mode 100644 index 0000000..afd79f8 --- /dev/null +++ b/.github/workflows/comparison-production.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: tutorials.groupdocs.cloud(comparison)(family)(Production) + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - 'content/comparison/**' + pull_request: + branches: [ master ] + paths: + - 'content/comparison/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of comparison that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + - name: Checkout theme repo + uses: actions/checkout@main + with: + repository: groupdocs-cloud/tutorials-theme + token: ${{ secrets.REPO_TOKEN }} + fetch-depth: 0 + path: themes/tutorials-theme + # Step 2 - Sets up the latest version of Hugo + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.135.0' + extended: true + - name: Install Dependicies1 + run: npm install -D --save autoprefixer + - name: Install Dependicies2 + run: npm install -D --save postcss-cli + # Also specifies the theme we want to use + - name: Build + run: hugo --configDir config/comparison --environment production --minify + + - name: Deploy tutorials.groupdocs.cloud(comparison)(family)(Production) to S3 + run: hugo --configDir config/comparison --environment production deploy --target "Production" --maxDeletes 0 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} + # Invalidate Cloudfront + - name: invalidate + uses: chetan/invalidate-cloudfront-action@v2 + env: + DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_PROD }} + PATHS: /comparison/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/.github/workflows/comparison-staging.yml b/.github/workflows/comparison-staging.yml new file mode 100644 index 0000000..cdbc5d9 --- /dev/null +++ b/.github/workflows/comparison-staging.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: qa-tutorials.groupdocs.cloud(comparison)(family)(Stage) + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ staging ] + paths: + - 'content/comparison/**' + pull_request: + branches: [ staging ] + paths: + - 'content/comparison/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of comparison that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + - name: Checkout theme repo + uses: actions/checkout@main + with: + repository: groupdocs-cloud/tutorials-theme + token: ${{ secrets.REPO_TOKEN }} + fetch-depth: 0 + path: themes/tutorials-theme + # Step 2 - Sets up the latest version of Hugo + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.135.0' + extended: true + - name: Install Dependicies1 + run: npm install -D --save autoprefixer + - name: Install Dependicies2 + run: npm install -D --save postcss-cli + # Also specifies the theme we want to use + - name: Build + run: hugo --configDir config/comparison --environment staging --minify + + - name: Deploy qa-tutorials.groupdocs.cloud(comparison)(family)(Stage) to S3 + run: hugo --configDir config/comparison --environment staging deploy --target "Stage" --maxDeletes 0 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} + # Invalidate Cloudfront + - name: invalidate + uses: chetan/invalidate-cloudfront-action@v2 + env: + DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }} + PATHS: /comparison/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/config/comparison/_default/config.toml b/config/comparison/_default/config.toml new file mode 100644 index 0000000..aa3608c --- /dev/null +++ b/config/comparison/_default/config.toml @@ -0,0 +1,150 @@ +baseURL = "/comparison" +title = "GroupDocs Cloud Tutorials" +staticdir = 'content/static' +enableRobotsTXT = true +enableGitInfo = true +disableKinds = ["taxonomy", "taxonomyTerm", "page", "RSS"] + +# Hugo allows theme composition (and inheritance). The precedence is from left to right. +theme = ["tutorials-theme"] + +[params.menu] +zh = "groupdocscloud-zh" +ru = "groupdocscloud-ru" +ar = "groupdocscloud-ar" +cs = "groupdocscloud-cs" +de = "groupdocscloud-de" +el = "groupdocscloud-el" +es = "groupdocscloud-es" +fr = "groupdocscloud-fr" +hi = "groupdocscloud-hi" +hu = "groupdocscloud-hu" +id = "groupdocscloud-id" +it = "groupdocscloud-it" +ja = "groupdocscloud-ja" +ko = "groupdocscloud-ko" +nl = "groupdocscloud-nl" +pl = "groupdocscloud-pl" +pt = "groupdocscloud-pt" +sv = "groupdocscloud-sv" +th = "groupdocscloud-th" +tr = "groupdocscloud-tr" +vi = "groupdocscloud-vi" +zh-hant = "groupdocscloud-zht" + +defaultContentLang = 'en' +[languages] + [languages.en] + contentDir = 'content/comparison/english' + languageName = 'English' + languageCode = "en" + flag = "flag-us" + weight = 10 + +ignoreFiles = ["(?i:readme.md)", '\.spin$'] + +# Image processing configuration. +[imaging] +resampleFilter = "CatmullRom" +quality = 75 +anchor = "smart" + +[services] +[services.googleAnalytics] +# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback]. +# id = "UA-00000000-0" + +[markup] + [markup.tableOfContents] + endLevel = 2 + ordered = true + startLevel = 2 + [markup.goldmark] + [markup.goldmark.renderer] + unsafe = true + [markup.highlight] + anchorLineNos = false + codeFences = true + guessSyntax = false + hl_Lines = "" + lineAnchors = "" + lineNoStart = 1 + lineNos = false + lineNumbersInTable = true + noClasses = false + tabWidth = 4 + +# Everything below this are Site Params + +[params] +copyright = "The GroupDocs Cloud Authors" +privacy_policy = "https://policies.google.com/privacy" +topbar_search_active = false +logo_rel_link = "" + +# Containerize Menu +[params.containerize] +menu = "groupdocscloud-en" + +[params.meta] +msapplication_TileColor = "#2b5797" +msapplication_config = "https://cms.admin.containerize.com/templates/groupdocscloud/images/browserconfig.xml" +theme_color = "#ffffff" +author = "GroupDocs Cloud" + +# Title of 404 page +title_404_page = "404 - Page Not Found | GroupDocs Cloud Tutorials" + +# Open Grapgh settings +title = "GroupDocs Cloud Tutorials" +images = ["images/aspose-cloud-image-for-open-graph.jpg"] +description = "REST APIs along with open-source SDKs that allow developers to enhance applications with the capability to display, annotate, convert, e-sign, merge, classify, compare & translate documents in the Cloud" + + +# Set to true to disable breadcrumb navigation. +breadcrumb_disable = false +# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled) +sidebar_search_disable = true +# Set to false if you don't want to display a logo (/assets/icons/logo.svg) in the top nav bar +navbar_logo = false +# Set to true to disable the About link in the site footer +footer_about_disable = false + + +[minify] + disableCSS = false + disableHTML = false + disableJS = false + disableJSON = false + disableSVG = false + disableXML = false + minifyOutput = true + [minify.tdewolff] + [minify.tdewolff.css] + decimals = -1 + keepCSS2 = true + [minify.tdewolff.html] + keepConditionalComments = true + keepDefaultAttrVals = true + keepDocumentTags = true + keepEndTags = true + keepQuotes = false + keepWhitespace = false + [minify.tdewolff.js] + [minify.tdewolff.json] + [minify.tdewolff.svg] + decimals = -1 + [minify.tdewolff.xml] + keepWhitespace = false + +[Taxonomies] + +[deployment] +[[deployment.matchers]] +# Set custom content type for /sitemap.xml +#pattern = "^sitemap\\.xml$" +#pattern = "^[a-z]\\.xml$" +pattern = "^.+\\.(xml)$" +contentType = "application/xml" +gzip = true +force = true diff --git a/config/comparison/production/config.toml b/config/comparison/production/config.toml new file mode 100644 index 0000000..8483198 --- /dev/null +++ b/config/comparison/production/config.toml @@ -0,0 +1,9 @@ +baseURL = "https://tutorials.groupdocs.cloud/comparison" + +# Google Tag Manager settings +[params.gtm] +gtm_id = "GTM-T42TVBC" + +[[deployment.targets]] +name = "Production" +URL = "s3://tutorials.groupdocs.cloud/?prefix=comparison/®ion=us-west-2" diff --git a/config/comparison/staging/config.toml b/config/comparison/staging/config.toml new file mode 100644 index 0000000..a357d4c --- /dev/null +++ b/config/comparison/staging/config.toml @@ -0,0 +1,8 @@ +baseURL = "https://qa-tutorials.groupdocs.cloud/comparison" + +[[deployment.targets]] +name = "Stage" +URL = "s3://qa-tutorials.groupdocs.cloud/?prefix=comparison /®ion=us-west-2" + + + diff --git a/content/comparison/english/_index.md b/content/comparison/english/_index.md new file mode 100644 index 0000000..2718224 --- /dev/null +++ b/content/comparison/english/_index.md @@ -0,0 +1,77 @@ +--- +title: GroupDocs.Comparison Cloud Developer Guide | Comprehensive Implementation Instructions +weight: 2 +description: Complete developer guide for implementing GroupDocs.Comparison Cloud API in your applications. Learn integration steps, code examples, and best practices. +url: /comparison/ +--- + +# GroupDocs.Comparison Cloud Developer Guide + +Welcome to the comprehensive developer guide for GroupDocs.Comparison Cloud. This guide provides detailed instructions on integrating and utilizing our powerful document comparison API in your applications. + +## Overview + +GroupDocs.Comparison Cloud is a REST API that allows you to compare documents across various formats and identify differences between them. This guide will walk you through the process of implementing the API in your projects, providing examples and best practices. + +## Getting Started + +###[Document Getting Started Tutorials](/comparison/getting-started/) + +Learn how to use GroupDocs.Comparison Cloud API to compare various document formats + +###[Document Advanced Features Tutorial](/comparison/advanced-features/) + +Tutorials for implementing advanced document comparison features using GroupDocs.Comparison Cloud API for developers + +###[Document Advanced Data Structures Tutorials](/comparison/advanced-data-structures/) + +Tutorials for working with advanced data structures in GroupDocs.Comparison Cloud API + +### Prerequisites + +Before integrating GroupDocs.Comparison Cloud into your application, ensure you have: + +- A GroupDocs.Comparison Cloud subscription or free trial +- Your Client ID and Client Secret credentials +- Basic understanding of REST APIs +- Familiarity with your preferred programming language + +### Authentication + +All API requests require authentication. To authenticate: + +1. Obtain your Client ID and Client Secret from your account dashboard +2. Use these credentials to generate an access token +3. Include the token in the header of all your API requests + +```javascript +// Example authentication code (JavaScript) +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Code to obtain access token +// ... +``` + +## Best Practices + +- Always use proper error handling in your integration +- Implement caching strategies for access tokens +- Consider file size limitations when uploading documents +- Use appropriate comparison settings based on document type +- Implement retry logic for API requests + +## API Reference + +For a complete reference of all API endpoints and parameters, refer to our [API Reference](https://reference.groupdocs.cloud/comparison/). + +## Support and Resources + +- [Developer Forum](https://forum.groupdocs.cloud/c/comparison) +- [Knowledge Base](https://kb.groupdocs.cloud/comparison) +- [GitHub Repositories](https://github.com/groupdocs-comparison-cloud) +- [Sample Applications](https://github.com/groupdocs-comparison-cloud-examples) + +## Conclusion + +GroupDocs.Comparison Cloud provides a powerful and flexible solution for document comparison needs. By following this developer guide, you should be able to successfully integrate and utilize the API in your applications. diff --git a/content/comparison/english/advanced-data-structures/_index.md b/content/comparison/english/advanced-data-structures/_index.md new file mode 100644 index 0000000..1c1fe54 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/_index.md @@ -0,0 +1,57 @@ +--- +title: GroupDocs.Comparison Cloud API Document Advanced Data Structures Tutorials +description: Step-by-step tutorials for working with advanced data structures in GroupDocs.Comparison Cloud API +weight: 10 +url: /advanced-data-structures/ +--- + +# Document Advanced Data Structures Tutorials + +Welcome to our comprehensive tutorial series on advanced data structures in GroupDocs.Comparison Cloud API! These hands-on tutorials are designed specifically for developers who want to master document comparison capabilities in cloud applications. + +## Learning Path + +This tutorial series follows a progressive learning path from basic to advanced concepts of working with data structures in GroupDocs.Comparison Cloud: + +1. Beginner Level: Learn about basic data structures like FileInfo, Format, and InfoResult +2. Intermediate Level: Master comparison settings, styles, and metadata management +3. Advanced Level: Implement complex operations with revisions and custom comparison options + +## Available Tutorials + +### Beginner Tutorials + +- [Learn to Work with FileInfo Structure](/advanced-data-structures/fileinfo/) - Discover how to properly configure file information for comparison operations +- [Tutorial: Understanding Format Data Structure](/advanced-data-structures/format/) - Learn to work with file format descriptions for proper document handling + +### Intermediate Tutorials + +- [Tutorial: Working with ItemsStyle Data Structure](/advanced-data-structures/itemsstyle/) - Learn to customize the appearance of comparison differences + +### Advanced Tutorials + +- [Comprehensive Guide to Settings Data Structure](/advanced-data-structures/settings/) - Configure all aspects of the comparison process +- [Tutorial: Working with DiagramMasterSetting](/advanced-data-structures/diagrammastersetting/) - Master diagram-specific comparison settings +- [Advanced Tutorial: Working with ChangeInfo Structure](/advanced-data-structures/changeinfo/) - Manage detailed change information in documents +- [Tutorial: Creating Powerful Comparisons with ComparisonOptions](/advanced-data-structures/comparisonoptions/) - Configure complete comparison operations +- [Tutorial: Applying Revisions with ApplyRevisionsOptions](/advanced-data-structures/applyrevisionsoptions/) - Learn to process document revisions programmatically + +## Getting Started + +To follow these tutorials, you'll need: + +1. A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps) +2. Basic knowledge of REST API concepts +3. Familiarity with your preferred programming language (examples provided in cURL, Python, Java, and C#) + +Each tutorial includes complete code examples with detailed explanations, helping you understand not just how to use these data structures, but why they're designed this way. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/applyrevisionsoptions/_index.md b/content/comparison/english/advanced-data-structures/applyrevisionsoptions/_index.md new file mode 100644 index 0000000..3fa5b67 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/applyrevisionsoptions/_index.md @@ -0,0 +1,142 @@ +--- +title: Applying Revisions with Options in GroupDocs.Comparison Cloud Tutorial +description: Learn how to process document revisions programmatically using the ApplyRevisionsOptions structure in GroupDocs.Comparison Cloud API. +url: /advanced-data-structures/applyrevisionsoptions/ +weight: 20 +--- + +# Tutorial: Applying Revisions with ApplyRevisionsOptions + +In this tutorial, you'll learn how to use the ApplyRevisionsOptions data structure in GroupDocs.Comparison Cloud API to programmatically apply or reject revisions in documents. This is particularly useful for automating document review workflows and managing tracked changes. + +## Learning Objectives + +- Understand the ApplyRevisionsOptions structure and its components +- Learn how to retrieve revision information from documents +- Implement selective acceptance or rejection of revisions +- Create efficient document revision workflows +- Save documents with processed revisions + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Advanced understanding of document revision concepts +- Familiarity with track changes in word processing documents +- Test documents with revisions for practice + +## Understanding the ApplyRevisionsOptions Structure + +The ApplyRevisionsOptions data structure defines options for applying revisions using the "PUT" /comparison/revisions API method. It allows you to specify which revisions to accept or reject in a document. + +```javascript +{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_with_revs.docx' + }, + 'Revisions': [ + { + 'Id': 0, + 'action': 'Accept' + }, + { + 'Id': 1, + 'action': 'Accept' + }, + ], + 'OutputPath': 'output/result.docx' +} +``` + +Key components include: + +| Component | Description | +|---|---| +| SourceFile | Information about the source file (using the FileInfo structure) | +| Revisions | Array of revision settings (using the RevisionInfo structure) | +| OutputPath | Path to the output document | + +## Implementing ApplyRevisionsOptions in Your Application + +### Step 1: Retrieving Revision Information + +Before you can apply revisions, you need to know what revisions exist in the document: + + + +#### Try it yourself +Retrieve the revision information from a document with tracked changes and examine the structure of the results. + +### Step 2: Creating a Basic Revision Application Configuration + +Now, let's create a basic configuration to apply some revisions: + + + +### Step 3: Selectively Accepting and Rejecting Revisions + +In real-world scenarios, you'll often want to selectively accept or reject revisions based on certain criteria: + + + +#### Troubleshooting Tip +If revisions aren't being applied as expected, verify that you're using the correct revision IDs and that the action values are correctly spelled ("Accept" or "Reject"). The API is case-sensitive. + +### Step 4: Handling Different Types of Revisions + +Different types of revisions (insertions, deletions, formatting changes) may require different handling: + + + +### Step 5: Creating a Complete Revision Application Workflow + +Finally, let's put everything together for a comprehensive revision application workflow: + + + +## Implementing Revision Strategies + +Let's explore some common revision management strategies: + +### Author-Based Revision Management + +Accept or reject revisions based on their authors: + + + +### Time-Based Revision Management + +Process revisions based on when they were made: + + + +### Content-Based Revision Management + +Make decisions based on the content of the revisions: + + + +## What You've Learned + +In this tutorial, you've learned: +- How to configure the ApplyRevisionsOptions structure for processing document revisions +- How to retrieve revision information from documents +- How to selectively accept or reject revisions +- How to implement different revision management strategies +- How to create complete revision processing workflows + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a revision management system that follows specific rules (e.g., accept all formatting changes but review content changes) +2. Build a batch processing system that applies the same revision rules to multiple documents +3. Implement a revision audit system that logs all revision decisions + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/changeinfo/_index.md b/content/comparison/english/advanced-data-structures/changeinfo/_index.md new file mode 100644 index 0000000..67351cc --- /dev/null +++ b/content/comparison/english/advanced-data-structures/changeinfo/_index.md @@ -0,0 +1,158 @@ +--- +title: Advanced Tutorial Working with Change Info Structure in GroupDocs.Comparison Cloud Tutorial +description: Learn how to manage detailed change information in document comparisons using the ChangeInfo structure in GroupDocs.Comparison Cloud API. +weight: 30 +url: /advanced-data-structures/changeinfo/ +--- + +# Advanced Tutorial: Working with ChangeInfo Structure + +In this advanced tutorial, you'll learn how to work with the ChangeInfo data structure in GroupDocs.Comparison Cloud API. This structure is crucial for managing detailed information about changes detected during document comparison operations and for implementing acceptance or rejection of specific changes. + +## Learning Objectives + +- Understand the ChangeInfo data structure and its properties +- Retrieve detailed change information from comparison results +- Process and filter changes based on their type and properties +- Implement change acceptance/rejection workflows +- Understand change coordinates and positioning information + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Advanced understanding of document comparison concepts +- Familiarity with RESTful APIs +- Test documents with various types of changes + +## Understanding the ChangeInfo Structure + +The ChangeInfo data structure represents detailed information about changes detected during comparison operations. It's returned by the `/comparison/changes` API and used by the `/comparison/updates` API. + +```javascript +{ + "id": 0, + "comparisonAction": "None", + "type": "Inserted", + "text": "lol", + "targetText": "Latin (i/?læt?n/, /?læt?n/; Latin: lingua lat?na, IPA: [?l????a la?ti?na]) is a classical language, originally spoken inLatium, Italy, which belongs to the Italic branch of the Indo-European languages.[3] The Latin alphabet is derived from the Etruscan and Greek alphabetslol.", + "authors": [ + "?GroupDocs" + ], + "styleChangeInfo": [], + "pageInfo": { + "width": 0, + "height": 0, + "pageNumber": 0 + }, + "box": { + "height": 0, + "width": 0, + "x": 0, + "y": 0 + } +} +``` + +Key properties include: + +| Property | Description | +|---|---| +| id | ID of the change | +| comparisonAction | Action to take (Accept, Reject, None) | +| type | Type of change (Inserted, Deleted, StyleChanged, etc.) | +| text | Source text | +| targetText | Target text | +| authors | Array of authors who made this change | +| pageInfo | Description of the page where the change is found | +| box | Coordinates and dimensions of the change | +| styleChangeInfo | Array of style changes with old and new values | + +## Implementing ChangeInfo in Your Application + +### Step 1: Retrieving Change Information + +First, let's see how to retrieve detailed change information from a comparison result: + + + +#### Try it yourself +Compare two versions of a document and retrieve the change information. Print out the changes to understand their structure. + +### Step 2: Filtering and Processing Changes + +Often, you'll want to filter changes based on their type or other properties: + + + +### Step 3: Implementing Change Acceptance/Rejection + +One of the most powerful features is the ability to selectively accept or reject changes: + + + +#### Troubleshooting Tip +If changes aren't being applied as expected, verify that you're using the correct change IDs and that the ComparisonAction property is set correctly. The API is case-sensitive. + +### Step 4: Working with Change Coordinates + +For visual representation of changes, you can use the coordinate information: + + + +### Step 5: Handling Style Changes + +Style changes require special handling: + + + +### Step 6: Creating a Complete Change Management Workflow + +Finally, let's put everything together for a complete change management workflow: + + + +## Advanced Change Processing Techniques + +For complex documents or workflows, consider these advanced techniques: + +### Batch Processing of Changes + +When dealing with documents that have many changes, process them in batches: + + + +### Automatic Change Classification + +Use the change properties to automatically classify changes: + + + +## What You've Learned + +In this tutorial, you've learned: +- The structure and purpose of the ChangeInfo data type +- How to retrieve and process change information +- How to implement change acceptance and rejection +- How to work with change coordinates and style information +- Advanced techniques for change processing and management + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a visual change viewer that displays changes with their actual coordinates +2. Implement an automated change acceptance system based on rules (e.g., accept all formatting changes but review content changes) +3. Build a change report generator that provides statistics and summaries of changes + +## Next Tutorial + +Continue your learning journey with our [Tutorial: Creating Powerful Comparisons with ComparisonOptions](/advanced-data-structures/comparisonoptions) tutorial to learn how to configure complete comparison operations. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/comparisonoptions/_index.md b/content/comparison/english/advanced-data-structures/comparisonoptions/_index.md new file mode 100644 index 0000000..e280063 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/comparisonoptions/_index.md @@ -0,0 +1,156 @@ +--- +title: Creating Powerful Comparisons with Comparison Options in GroupDocs.Comparison Cloud Tutorial +description: Learn how to configure complete document comparison operations using the ComparisonOptions structure in GroupDocs.Comparison Cloud API. +weight: 40 +url: /advanced-data-structures/comparisonoptions/ +--- + +# Tutorial: Creating Powerful Comparisons with ComparisonOptions + +In this tutorial, you'll learn how to use the ComparisonOptions data structure in GroupDocs.Comparison Cloud API to configure comprehensive document comparison operations. This structure brings together multiple configuration elements to give you complete control over the comparison process. + +## Learning Objectives + +- Understand the ComparisonOptions structure and its components +- Configure source and target document references +- Implement detailed comparison settings +- Specify output paths and formats +- Create complete comparison operations for different document types + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Advanced understanding of document comparison concepts +- Familiarity with JSON structures +- Test documents for comparison operations + +## Understanding the ComparisonOptions Structure + +The ComparisonOptions data structure defines a complete comparison operation, including source and target files, comparison settings, and output options. + +```javascript +{ + "SourceFile": { + "FilePath": "string", + "VersionId": "string", + "StorageName": "string", + "Password": "string" + }, + "TargetFiles": [ + { + "FilePath": "string", + "VersionId": "string", + "StorageName": "string", + "Password": "string" + } + ], + "Settings": { + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + // ... additional settings ... + }, + "ChangeType": "None", + "OutputPath": "string" +} +``` + +Key components include: + +| Component | Description | +|---|---| +| SourceFile | Information about the source file (using the FileInfo structure) | +| TargetFiles | An array of information about target file(s) (using the FileInfo structure) | +| Settings | Comparison process settings (using the Settings structure) | +| ChangeType | Changes type (used only for Changes resource) | +| OutputPath | Path to the resultant document | + +## Implementing ComparisonOptions in Your Application + +### Step 1: Creating a Basic Comparison Configuration + +Let's start with a basic configuration that compares two documents with default settings: + + + +#### Try it yourself +Create a basic ComparisonOptions object and use it to compare two simple documents. + +### Step 2: Configuring Multiple Target Files + +ComparisonOptions supports comparing one source file with multiple target files: + + + +### Step 3: Implementing Detailed Comparison Settings + +Now let's enhance our comparison with detailed settings: + + + +#### Troubleshooting Tip +If your comparison results don't match expectations, verify that the Settings configuration is appropriate for your document types. Different document formats may require specific settings for optimal results. + +### Step 4: Working with Password-Protected Documents + +Many business documents are password-protected. Here's how to handle them: + + + +### Step 5: Specifying Output Options + +Control how and where the comparison result is saved: + + + +### Step 6: Creating a Complete Comparison Operation + +Finally, let's put everything together for a comprehensive comparison operation: + + + +## Best Practices for Different Comparison Scenarios + +### Document Review Workflow + +For a document review workflow, prioritize visibility and tracking of changes: + + + +### Legal Document Comparison + +For legal documents, precision and comprehensive detection are critical: + + + +### Visual Content Comparison + +When comparing documents with significant visual content: + + + +## What You've Learned + +In this tutorial, you've learned: +- How to configure the ComparisonOptions structure for document comparison +- How to specify source and target documents with appropriate metadata +- How to implement detailed comparison settings +- How to control the output format and location +- Best practices for different comparison scenarios + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a comparison operation that compares multiple versions of the same document +2. Build a system that compares documents from different storage providers +3. Implement a comparison workflow with customized settings for different document types + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/diagrammastersetting/_index.md b/content/comparison/english/advanced-data-structures/diagrammastersetting/_index.md new file mode 100644 index 0000000..098a5e1 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/diagrammastersetting/_index.md @@ -0,0 +1,107 @@ +--- +title: Working with Diagram Master Setting in GroupDocs.Comparison Cloud Tutorial +description: Learn how to configure master diagram settings for comparison operations using the DiagramMasterSetting structure in GroupDocs.Comparison Cloud API. +weight: 50 +url: /advanced-data-structures/diagrammastersetting/ +--- + +# Tutorial: Working with DiagramMasterSetting + +In this tutorial, you'll learn how to use the DiagramMasterSetting data structure in GroupDocs.Comparison Cloud API to configure master diagram settings for diagram comparison operations. This is particularly important when comparing Visio and other diagram formats. + +## Learning Objectives + +- Understand the purpose and structure of DiagramMasterSetting +- Learn how to configure master diagram paths for comparison +- Implement source master usage settings +- Create effective diagram comparison configurations for different scenarios + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Basic understanding of diagram file formats (especially Visio) +- Familiarity with document comparison concepts +- Access to diagram files for testing + +## Understanding DiagramMasterSetting Structure + +The DiagramMasterSetting data structure is used for setting master diagram properties for diagram comparison results, especially when working with Visio files that rely on master shapes. + +```javascript +{ + "MasterPath": "string", + "UseSourceMaster": true +} +``` + +Key properties include: + +| Property | Description | +|---|---| +| MasterPath | Path to custom master path | +| UseSourceMaster | Value indicating whether to use master from source and target document together | + +## Implementing DiagramMasterSetting in Your Application + +### Step 1: Basic Configuration for Diagram Comparison + +Let's start with a basic configuration that uses a custom master path: + + + +#### Try it yourself +Configure a simple diagram comparison with a custom master path and verify the results are as expected. + +### Step 2: Using Source Masters + +In many cases, you'll want to use the masters from the source document. Here's how to configure that: + + + +### Step 3: Advanced Configuration for Complex Diagrams + +For more complex diagrams that might reference multiple masters, you'll need a more sophisticated approach: + + + +#### Troubleshooting Tip +If diagram elements appear incorrectly in the comparison result, verify that the master path is correctly set and accessible. Missing master references can cause diagram elements to render incorrectly. + +### Step 4: Integrating with Complete Comparison Settings + +Finally, let's see how DiagramMasterSetting fits into a complete comparison configuration: + + + +## What You've Learned + +In this tutorial, you've learned: +- The purpose and structure of the DiagramMasterSetting data structure +- How to configure custom master paths for diagram comparison +- How to use source masters in comparison operations +- How to integrate diagram master settings into complete comparison configurations + +## Common Issues and Solutions + +| Issue | Solution | +|---|---| +| Missing diagram elements in comparison results | Verify master path is correct and accessible | +| Incorrect styling of compared elements | Check that the master contains the expected styles | +| Performance issues with large diagrams | Consider optimizing master diagrams to include only necessary elements | + +## Further Practice + +Try these exercises to reinforce your learning: +1. Compare two versions of a complex Visio diagram with custom master settings +2. Create a function that automatically detects and configures the appropriate master settings based on diagram type +3. Implement error handling for common diagram comparison issues + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/fileinfo/_index.md b/content/comparison/english/advanced-data-structures/fileinfo/_index.md new file mode 100644 index 0000000..f67791f --- /dev/null +++ b/content/comparison/english/advanced-data-structures/fileinfo/_index.md @@ -0,0 +1,111 @@ +--- +title: Learn to Work with File Info Structure in GroupDocs.Comparison Cloud +description: This tutorial teaches you how to properly configure file information for document comparison operations using GroupDocs.Comparison Cloud API. +weight: 60 +url: /advanced-data-structures/fileinfo/ +--- + +# Tutorial: How to Work with FileInfo Structure + +In this tutorial, you'll learn how to effectively use the FileInfo data structure in GroupDocs.Comparison Cloud API. By the end, you'll be able to properly configure files for comparison operations including handling password-protected documents and accessing files from different storage locations. + +## Learning Objectives + +- Configure the basic FileInfo structure for document comparison +- Access files from different storage providers +- Work with password-protected documents +- Specify particular versions of documents for comparison + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Basic knowledge of REST API concepts +- A development environment with your preferred language (examples available in cURL, Python, Java, and C#) + +## Understanding FileInfo Structure + +The FileInfo data structure is fundamental to GroupDocs.Comparison Cloud API as it describes the input files for comparison operations. Let's examine its structure: + +```javascript +{ + "FilePath": "string", + "VersionId": "string", + "StorageName": "string", + "Password": "string" +} +``` + +Key properties include: + +| Property | Description | +|---|---| +| FilePath | Path of the file in the cloud storage | +| VersionId | File Version (optional) | +| StorageName | Name of the cloud storage (optional, default storage used if omitted) | +| Password | Password for protected documents | + +## Implementing FileInfo in Your Application + +### Step 1: Set Up Basic FileInfo Configuration + +Let's start with a simple scenario where we need to compare two regular documents from the default storage: + + + +#### Try it yourself +Create a basic FileInfo object pointing to a document in your default storage and print its contents to verify it's correctly configured. + +### Step 2: Working with Password-Protected Documents + +Many business documents are password-protected. Here's how to configure FileInfo for such documents: + + + +#### Try it yourself +Create a FileInfo object for a password-protected document in your storage. Try comparing it with another document to verify the password is correctly applied. + +### Step 3: Specifying Storage Providers + +If you have multiple storage providers configured, you can specify which one to use: + + + +#### Troubleshooting Tip +If you receive a "Storage not found" error, verify the storage name is correctly spelled and properly registered in your GroupDocs.Comparison Cloud dashboard. + +### Step 4: Working with File Versions + +For systems that maintain document versions, you can specify which version to use: + + + +## What You've Learned + +In this tutorial, you've learned: +- How to configure the basic FileInfo structure +- How to work with password-protected documents +- How to specify storage providers +- How to work with document versions + +This knowledge forms the foundation for all document comparison operations in GroupDocs.Comparison Cloud API. + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a program that compares a document with multiple versions of itself +2. Write a function that validates if FileInfo is correctly configured before sending to the API +3. Implement error handling for common FileInfo configuration issues + +## Next Tutorial + +Ready to learn more? Continue to our [Tutorial: Understanding Format Data Structure](/advanced-data-structures/format/) to learn how GroupDocs.Comparison Cloud API handles different file formats. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/format/_index.md b/content/comparison/english/advanced-data-structures/format/_index.md new file mode 100644 index 0000000..221d322 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/format/_index.md @@ -0,0 +1,92 @@ +--- +title: Understanding Format Data Structure in GroupDocs.Comparison Cloud Tutorial +description: Learn how to work with file format descriptions in GroupDocs.Comparison Cloud API to ensure proper document handling in your applications. +weight: 70 +url: /advanced-data-structures/format/ +--- + +# Tutorial: Understanding the Format Data Structure + +In this tutorial, you'll learn how to work with the Format data structure in GroupDocs.Comparison Cloud API. This knowledge is essential for handling different file formats correctly in your document comparison applications. + +## Learning Objectives + +- Understand the purpose of the Format data structure +- Learn how to interpret Format information from API responses +- Implement format validation in your applications +- Handle format-specific comparison settings + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Basic understanding of RESTful APIs +- Familiarity with your preferred programming language + +## What is the Format Data Structure? + +The Format data structure provides information about supported file formats in the GroupDocs.Comparison Cloud API. It's typically returned when querying information about documents and helps you determine how to handle different file types. + +```javascript +{ + "Extension": "string", + "FileFormat": "string" +} +``` + +Key properties include: + +| Property | Description | +|---|---| +| Extension | File format extension (e.g., "docx", "pdf") | +| FileFormat | File format name (e.g., "Microsoft Word Document", "Portable Document Format") | + +## Working with the Format Structure + +### Step 1: Retrieving Format Information + +One common scenario is retrieving format information about documents before comparison: + + + +#### Try it yourself +Use the API to retrieve format information about a document in your storage and print the Extension and FileFormat properties. + +### Step 2: Validating Document Formats for Comparison + +Not all formats can be compared with each other. Here's how to validate if two documents are compatible for comparison: + + + +### Step 3: Handling Format-Specific Comparison Settings + +Different formats may require specific comparison settings. Here's how to adjust your comparison based on format: + + + +#### Troubleshooting Tip +If you encounter unexpected comparison results, verify that you're using format-appropriate settings. For example, comparing images requires different settings than comparing text documents. + +## What You've Learned + +In this tutorial, you've learned: +- The structure and purpose of the Format data type +- How to retrieve format information from documents +- How to validate document compatibility based on formats +- How to adjust comparison settings based on document formats + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a function that checks if a given file format is supported by GroupDocs.Comparison Cloud +2. Build a format validation system that provides user-friendly error messages for incompatible formats +3. Implement format-based settings optimization that automatically adjusts comparison settings based on the document type + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/itemsstyle/_index.md b/content/comparison/english/advanced-data-structures/itemsstyle/_index.md new file mode 100644 index 0000000..99c3bd3 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/itemsstyle/_index.md @@ -0,0 +1,111 @@ +--- +title: Working with ItemsStyle Data Structure in GroupDocs.Comparison Cloud Tutorial +description: Learn how to customize the appearance of document comparison differences using the ItemsStyle data structure in GroupDocs.Comparison Cloud API. +weight: 80 +url: /advanced-data-structures/itemsstyle/ +--- + +# Tutorial: Working with ItemsStyle Data Structure + +In this tutorial, you'll learn how to use the ItemsStyle data structure to customize the appearance of comparison differences in GroupDocs.Comparison Cloud API. By the end, you'll be able to create visually distinctive comparison results that highlight changes according to your specific requirements. + +## Learning Objectives + +- Understand the ItemsStyle structure and its properties +- Configure visual styling for inserted, deleted, and changed content +- Apply custom separators for comparison differences +- Create different styling profiles for various types of document comparisons + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Basic understanding of document comparison concepts +- Familiarity with JSON structures +- A development environment with your preferred language + +## Understanding the ItemsStyle Structure + +The ItemsStyle data structure is used for styling comparison differences in the result document. It allows you to customize how inserted, deleted, and changed content appears. + +```javascript +{ + "FontColor": "string", + "HighlightColor": "string", + "BeginSeparatorString": "string", + "EndSeparatorString": "string", + "Bold": true, + "Italic": true, + "StrikeThrough": true, + "Underline": true +} +``` + +Key properties include: + +| Property | Description | +|---|---| +| FontColor | Font color for changed components (RGB color string converted to integer) | +| HighlightColor | Highlight color for changed components | +| BeginSeparatorString | Start tag for changed components | +| EndSeparatorString | End tag for changed components | +| Bold | Bold style for changed components | +| Italic | Italic style for changed components | +| StrikeThrough | Strike through style for changed components | +| Underline | Underline style for changed components | + +## Implementing ItemsStyle in Your Application + +### Step 1: Creating Basic Style Configurations + +Let's start by creating basic style configurations for inserted, deleted, and changed content: + + + +#### Try it yourself +Create three different ItemsStyle objects with distinct visual appearances and test them in a comparison operation. + +### Step 2: Working with Color Properties + +Colors are represented as string values of RGB colors converted to integers. Here's how to work with them: + + + +#### Troubleshooting Tip +If colors don't appear as expected, verify that you're using the correct string representation of RGB values. The API expects integers as strings, not hex color codes. + +### Step 3: Using Separator Strings + +Separator strings can be used to clearly mark the beginning and end of changes: + + + +### Step 4: Creating a Complete Styling Configuration + +Now, let's put it all together to create a comprehensive styling configuration: + + + +## What You've Learned + +In this tutorial, you've learned: +- How to configure the visual appearance of comparison differences +- How to work with color properties in the ItemsStyle structure +- How to apply custom separators to mark changes +- How to create comprehensive styling configurations for different change types + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create a "track changes" style that mimics the appearance of Microsoft Word's track changes feature +2. Implement a styling configuration that optimizes for printing (high contrast, clear markings) +3. Design a style configuration for accessibility (considering color blindness and other visual impairments) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-data-structures/settings/_index.md b/content/comparison/english/advanced-data-structures/settings/_index.md new file mode 100644 index 0000000..b0fd831 --- /dev/null +++ b/content/comparison/english/advanced-data-structures/settings/_index.md @@ -0,0 +1,239 @@ +--- +title: Comprehensive Guide to Settings Data Structure in GroupDocs.Comparison Cloud +description: Learn how to master the Settings data structure to configure all aspects of the document comparison process in GroupDocs.Comparison Cloud API. +weight: 80 +url: /advanced-data-structures/settings/ +--- + +# Comprehensive Guide to Settings Data Structure + +In this detailed tutorial, you'll learn how to work with the Settings data structure in GroupDocs.Comparison Cloud API. This powerful structure allows you to configure virtually every aspect of the comparison process, from styling to content handling. + +## Learning Objectives + +- Master the comprehensive Settings data structure +- Configure visual appearance of comparison differences +- Control which types of content are shown in comparison results +- Implement advanced comparison features like sensitivity and word separation +- Configure metadata handling and security options + +## Prerequisites + +- GroupDocs.Comparison Cloud API credentials +- Advanced understanding of document comparison concepts +- Familiarity with JSON structures +- Test documents for comparison operations + +## Understanding the Settings Structure + +The Settings data structure defines additional configuration options for the comparison process, allowing fine-grained control over how documents are compared and how differences are presented. + +```javascript +{ + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + "StyleChangeDetection": true, + "InsertedItemsStyle": { + "FontColor": "string", + "HighlightColor": "string", + "BeginSeparatorString": "string", + "EndSeparatorString": "string", + "Bold": true, + "Italic": true, + "StrikeThrough": true, + "Underline": true + }, + "DeletedItemsStyle": { + "FontColor": "string", + "HighlightColor": "string", + "BeginSeparatorString": "string", + "EndSeparatorString": "string", + "Bold": true, + "Italic": true, + "StrikeThrough": true, + "Underline": true + }, + "ChangedItemsStyle": { + "FontColor": "string", + "HighlightColor": "string", + "BeginSeparatorString": "string", + "EndSeparatorString": "string", + "Bold": true, + "Italic": true, + "StrikeThrough": true, + "Underline": true + }, + "WordsSeparatorChars": [ + "string" + ], + "UseFramesForDelInsElements": true, + "CalculateComponentCoordinates": true, + "MarkChangedContent": true, + "MarkNestedContent": true, + "MetaData": { + "Author": "string", + "LastSaveBy": "string", + "Company": "string" + }, + "Password": "string", + "DiagramMasterSetting": { + "MasterPath": "string", + "UseSourceMaster": true + }, + "OriginalSize": { + "Width": 0, + "Height": 0 + }, + "HeaderFootersComparison": true, + "SensitivityOfComparison": 0 +} +``` + +With over 20 configurable properties, Settings provides comprehensive control over the comparison process. + +## Implementing Settings in Your Application + +Given the complexity of this structure, we'll break down our implementation into logical sections. + +### Step 1: Configuring Basic Comparison Settings + +Let's start with the most commonly used settings: + + + +#### Try it yourself +Create a basic Settings object with the most common options and test it with a comparison operation. + +### Step 2: Styling Comparison Differences + +Now let's configure the styling options for different types of changes: + + + +### Step 3: Advanced Word Processing Settings + +For text-based documents, you can fine-tune how words are processed during comparison: + + + +#### Troubleshooting Tip +If the comparison isn't detecting changes as expected, try adjusting the SensitivityOfComparison value and WordsSeparatorChars array to better match your document content. + +### Step 4: Configuring Metadata and Security Options + +Control how metadata is handled in the comparison result: + + + +### Step 5: Format-Specific Settings + +Different document formats may need specific settings: + + + +### Step 6: Creating a Comprehensive Settings Configuration + +Finally, let's put everything together for a complete configuration: + + + +## Best Practices for Different Document Types + +Different document types benefit from specific settings configurations: + +### Word Processing Documents (DOCX, DOC, RTF) + +```javascript +{ + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + "StyleChangeDetection": true, + "HeaderFootersComparison": true, + "SensitivityOfComparison": 75, + "WordsSeparatorChars": [" ", "\t", "\n"] +} +``` + +### Spreadsheets (XLSX, XLS) + +```javascript +{ + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + "StyleChangeDetection": false, + "CalculateComponentCoordinates": true, + "SensitivityOfComparison": 100 +} +``` + +### Presentations (PPTX, PPT) + +```javascript +{ + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + "StyleChangeDetection": true, + "CalculateComponentCoordinates": true, + "MarkChangedContent": true +} +``` + +### PDF Documents + +```javascript +{ + "GenerateSummaryPage": true, + "ShowDeletedContent": true, + "ShowInsertedContent": true, + "StyleChangeDetection": false, + "CalculateComponentCoordinates": true, + "SensitivityOfComparison": 90 +} +``` + +## What You've Learned + +In this comprehensive tutorial, you've learned: +- How to configure the extensive Settings data structure +- How to customize the appearance of comparison differences +- How to control content visibility in comparison results +- How to fine-tune comparison sensitivity and word processing +- How to handle metadata and security options +- Best practices for different document types + +You now have the knowledge to create highly customized document comparison operations that meet your specific requirements. + +## Common Issues and Solutions + +| Issue | Solution | +|---|---| +| Too many differences detected | Decrease the SensitivityOfComparison value | +| Missing subtle differences | Increase the SensitivityOfComparison value | +| Missing changes in headers/footers | Set HeaderFootersComparison to true | +| Poor performance with large documents | Disable unnecessary features like StyleChangeDetection | +| Incorrect styling in result document | Check the styling configurations for inserted/deleted/changed items | + +## Further Practice + +Try these exercises to reinforce your learning: +1. Create settings configurations optimized for different use cases (legal documents, code review, content editing) +2. Implement a settings builder that helps users configure comparison settings without understanding the JSON structure +3. Test different sensitivity levels to find the optimal setting for your specific document types + +## Next Tutorial + +Continue your learning journey with our [Advanced Tutorial: Working with ChangeInfo Structure](/advanced-data-structures/changeinfo/) tutorial to understand how to manage detailed change information in document comparisons. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/_index.md b/content/comparison/english/advanced-features/_index.md new file mode 100644 index 0000000..b05fa7b --- /dev/null +++ b/content/comparison/english/advanced-features/_index.md @@ -0,0 +1,71 @@ +--- +title: GroupDocs.Comparison Cloud API Document Advanced Features Tutorial +description: Step-by-step tutorials for implementing advanced document comparison features using GroupDocs.Comparison Cloud API for developers +weight: 10 +url: /advanced-features/ +--- + +# Advanced Features Tutorials for GroupDocs.Comparison Cloud API + +Welcome to our comprehensive tutorial series on advanced features of GroupDocs.Comparison Cloud API. These hands-on tutorials are designed to help developers master the powerful capabilities of the API for comparing documents in the cloud. + +## Learning Path + +This tutorial series follows a structured learning path that builds your skills progressively from basic to advanced features: + +1. Foundation - Learn the core concepts of document comparison with multiple files and password protection +2. Customization - Master techniques for customizing comparison styles and sensitivity +3. Change Management - Implement advanced features for handling document revisions and changes +4. Output Control - Learn to configure document metadata and security in comparison results + +## Available Tutorials + +### Working with Multiple Documents + +- [Tutorial: How to Compare Multiple Documents](/advanced-features/compare-multiple-documents/) - Learn to compare more than two documents simultaneously with detailed difference tracking. +- [Tutorial: How to Compare Password-Protected Documents](/advanced-features/compare-password-protected/) - Step-by-step guide to comparing documents secured with passwords. +- [Tutorial: How to Compare Multiple Password-Protected Documents](/advanced-features/compare-multiple-password-protected/) - Learn advanced techniques for comparing multiple documents with password protection. + +### Customizing Comparison Settings + +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) - Master the styling of different change types for better visualization. +- [Tutorial: How to Adjust Comparison Sensitivity](/advanced-features/compare-sensitivity/) - Learn to fine-tune the sensitivity of the comparison algorithm for optimal results. + +### Managing Document Changes + +- [Tutorial: How to Get a List of Changes](/advanced-features/get-list-of-changes/) - Step-by-step guide to retrieving all changes between documents. +- [Tutorial: How to Get Change Coordinates](/advanced-features/get-changes-coordinates/) - Learn to detect spatial locations of changes within documents. +- [Tutorial: How to Accept or Reject Document Changes](/advanced-features/accept-reject-document-changes/) - Master the techniques for selective implementation of changes. + +### Working with Document Revisions + +- [Tutorial: How to Get a List of Revisions](/advanced-features/get-list-of-revisions/) - Learn to extract all revisions from a Word document. +- [Tutorial: How to Accept or Reject Revisions](/advanced-features/accept-reject-revisions/) - Step-by-step guide to selectively accepting revisions. +- [Tutorial: How to Accept All Revisions](/advanced-features/accept-all-revisions/) - Learn to quickly accept all revisions in a document. +- [Tutorial: How to Reject All Revisions](/advanced-features/reject-all-revisions/) - Master the technique for rejecting all revisions at once. + +### Configuring Output Options + +- [Tutorial: How to Set Password for Result Document](/advanced-features/set-password-for-resultant-document/) - Step-by-step guide to securing the comparison output. + +### Additional Resources + +- [Tutorial: How to Monitor Metered Consumption](/advanced-features/metered-consumption) - Learn to track API usage with the metered license option. + +## Prerequisites + +Before starting these tutorials, ensure you have: + +1. A GroupDocs.Comparison Cloud API subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Basic knowledge of REST API concepts +3. Familiarity with your programming language of choice (C#, Java, PHP, Node.js, Python, or Ruby) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/accept-all-revisions/_index.md b/content/comparison/english/advanced-features/accept-all-revisions/_index.md new file mode 100644 index 0000000..409e57d --- /dev/null +++ b/content/comparison/english/advanced-features/accept-all-revisions/_index.md @@ -0,0 +1,257 @@ +--- +title: How to Accept All Revisions Tutorial +description: Learn to efficiently accept all document revisions at once using GroupDocs.Comparison Cloud API in this step-by-step tutorial +weight: 10 +url: /advanced-features/accept-all-revisions/ +--- + +# Tutorial: How to Accept All Revisions + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Quickly accept all revisions in a Word document with a single API call +- Understand the difference between selective revision processing and batch acceptance +- Implement efficient document finalization workflows + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Word documents with tracked changes (revisions) ready in your cloud storage + +## The Practical Scenario + +Imagine you're managing the final stage of a document review process. After multiple rounds of collaborative editing with tracked changes, all stakeholders have approved the document and its revisions. Now, you need to finalize the document by accepting all tracked changes at once, rather than reviewing and accepting each revision individually. + +With GroupDocs.Comparison Cloud API, you can efficiently accept all revisions with a single API call, streamlining your document finalization process. + +## Understanding Batch Revision Acceptance + +While the [selective revision acceptance](/advanced-features/accept-reject-revisions/) tutorial showed how to process revisions individually, many workflows require a more efficient way to accept all revisions at once. + +The GroupDocs.Comparison Cloud API provides a dedicated option for this purpose. Instead of retrieving all revisions and marking each one for acceptance, you can set the `AcceptAll` parameter to `true` in a single API call. + +## Step 1: Upload Your Document to Cloud Storage + +Before processing revisions, you need to upload a Word document with tracked changes to cloud storage. For this tutorial, we'll work with: +- source_with_revs.docx (a document with track changes enabled and several revisions) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Accept All Revisions + +Now, let's accept all revisions in the document with a single API call: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/revisions" \ +-X PUT \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_with_revs.docx' + }, + 'AcceptAll': true, + 'OutputPath': 'output/result.docx' +}" +``` + +Notice that instead of providing a list of revisions with individual actions, we simply set `AcceptAll` to `true`. This tells the API to accept all revisions in the document automatically. + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains the original document with all revisions accepted. The tracked changes are now permanently incorporated into the document content. + +## Try It Yourself + +Now it's your turn to implement batch revision acceptance in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new ReviewApi(configuration); + +var options = new ApplyRevisionsOptions +{ + SourceFile = new FileInfo {FilePath = "source_files/word/source_with_revs.docx" }, + AcceptAll = true, + OutputPath = "output/result.docx" +}; + +var response = apiInstance.ApplyRevisions(new ApplyRevisionsRequest(options)); + +Console.WriteLine("ApplyRevisions: Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +ReviewApi apiInstance = new ReviewApi(configuration); + +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source_with_revs.docx"); + +ApplyRevisionsOptions options = new ApplyRevisionsOptions(); +options.setSourceFile(sourceFileInfo); +options.setAcceptAll(true); +options.setOutputPath("output/result.docx"); + +Link response = apiInstance.applyRevisions(new ApplyRevisionsRequest(options)); + +System.out.println("Output file link: " + response.getHref()); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source_with_revs.docx" +options = groupdocs_comparison_cloud.ApplyRevisionsOptions() +options.source_file = source +options.accept_all = True +options.output_path = "output/result.docx" + +response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options)) + +print("Output file link: " + response.href) +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.reviewApi = comparison_cloud.ReviewApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source_with_revs.docx"; + + let options = new comparison_cloud.ApplyRevisionsOptions(); + options.sourceFile = source; + options.acceptAll = true; + options.outputPath = "output/result.docx"; + + let response = await reviewApi.applyRevisions(new comparison_cloud.ApplyRevisionsRequest(options)); + console.log("Output file link: " + response.href); +} catch (error) { + console.log(error.message); +} +``` + +## When to Use Batch Acceptance vs. Selective Processing + +Understanding when to use batch acceptance versus selective processing is important for efficient document workflows: + +Use Batch Acceptance (AcceptAll) when: +- All stakeholders have approved all changes in the document +- You need to quickly finalize a document after the review process is complete +- The document has a large number of minor revisions that don't require individual review +- You're implementing a streamlined workflow where certain document types can be auto-approved + +Use Selective Processing when: +- Different stakeholders have different levels of approval authority +- Some revisions require additional review or discussion +- You need to maintain a record of which revisions were accepted or rejected +- You're implementing a complex approval workflow with conditional logic + +## Common Issues and Troubleshooting + +1. Document Format Limitations: This feature is primarily designed for Word documents (.docx, .doc). Other formats may not support revision tracking or may have limited support. + +2. No Revisions Found: If the document doesn't contain any tracked changes, the API will still execute successfully, but no changes will occur in the document. + +3. Performance Considerations: For documents with a very large number of revisions, batch acceptance is significantly more efficient than processing each revision individually. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What parameter do you set to accept all revisions in a document? +2. How does batch acceptance differ from selective revision processing? +3. In what scenarios would batch acceptance be more appropriate than selective processing? +4. Does batch acceptance modify the original document or create a new one? + +## What You've Learned + +In this tutorial, you've learned how to: +- Quickly accept all revisions in a Word document with a single API call +- Understand the difference between selective revision processing and batch acceptance +- Implement efficient document finalization workflows + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a document processing pipeline that automatically accepts all revisions after a specified approval date +2. Implement a hybrid approach that automatically accepts certain types of revisions (e.g., formatting) but requires manual review for content changes +3. Build a simple command-line utility that accepts all revisions in multiple documents at once + +## Next Steps + +Now that you've learned to accept all revisions at once, check out these related tutorials: +- [Tutorial: How to Reject All Revisions](/advanced-features/reject-all-revisions/) +- [Tutorial: How to Accept or Reject Revisions](/advanced-features/accept-reject-revisions/) +- [Tutorial: How to Get List of Revisions](/advanced-features/get-list-of-revisions/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/accept-reject-document-changes/_index.md b/content/comparison/english/advanced-features/accept-reject-document-changes/_index.md new file mode 100644 index 0000000..42311d6 --- /dev/null +++ b/content/comparison/english/advanced-features/accept-reject-document-changes/_index.md @@ -0,0 +1,371 @@ +--- +title: How to Accept or Reject Document Changes Tutorial +description: Learn to selectively apply or discard specific changes between document versions using GroupDocs.Comparison Cloud API in this step-by-step tutorial +weight: 20 +url: /advanced-features/accept-reject-document-changes/ +--- + +# Tutorial: How to Accept or Reject Document Changes + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Selectively apply or discard specific changes between document versions +- Process a list of changes with accept/reject decisions +- Generate a final document that incorporates only the changes you want + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're reviewing a legal contract that has undergone multiple revisions. You need to carefully review each change and decide whether to accept or reject it before creating the final version. Some changes improve the contract's clarity, while others might introduce unwanted terms or conditions. + +With GroupDocs.Comparison Cloud API, you can: +1. First compare the documents to identify all changes +2. Review each change individually +3. Mark each change as accepted or rejected +4. Generate a final document that incorporates only the accepted changes + +This workflow enables precise control over document revisions in collaborative environments. + +## Understanding the Accept/Reject Process + +The process involves two main API calls: + +1. First, you call the `changes` endpoint to get a list of all changes between the documents +2. Then, for each change, you set a `comparisonAction` value: + - `Accept` - to include the change in the final document + - `Reject` - to exclude the change from the final document +3. Finally, you call the `updates` endpoint with your modified changes list to generate the final document + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Get the List of Changes + +First, retrieve all changes between the documents: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/changes" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ] +}" +``` + +The API will return a JSON array containing all detected changes. Each change has an `id` property that you'll use to reference it when accepting or rejecting. + +## Step 4: Apply Accept/Reject Decisions + +Now, let's apply our decisions to the changes. In this example, we'll accept the first change (id: 0) and reject all others: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/updates" \ +-X PUT \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'OutputPath': 'output/result.docx', + 'Changes': [ + { + 'id': 0, + 'comparisonAction': 'Accept' + }, + { + 'id': 1, + 'comparisonAction': 'Reject' + }, + { + 'id': 2, + 'comparisonAction': 'Reject' + } + // Add more changes as needed + ] +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 5: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains only the changes you accepted (in this case, only the change with id: 0), while all rejected changes are not applied. + +## Try It Yourself + +Now it's your turn to implement the accept/reject workflow in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new UpdatesOptions +{ + SourceFile = new FileInfo {FilePath = "source_files/word/source.docx"}, + TargetFiles = new List {new FileInfo {FilePath = "target_files/word/target.docx"}}, + OutputPath = "output/result.docx" +}; + +// First, get all changes +var changes = apiInstance.PostChanges(new PostChangesRequest(options)); + +// Process the changes - in this example, we'll accept only the first change +foreach (var change in changes) + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Reject; + +// Accept just the first change +if (changes.Count > 0) + changes[0].ComparisonAction = ChangeInfo.ComparisonActionEnum.Accept; + +// Update the options with our decision +options.Changes = changes; + +// Generate the result document +var response = apiInstance.PutChangesDocument(new PutChangesDocumentRequest(options)); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +CompareApi apiInstance = new CompareApi(configuration); +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source.docx"); +FileInfo targetFileInfo = new FileInfo(); +targetFileInfo.setFilePath("target_files/word/target.docx"); + +UpdatesOptions options = new UpdatesOptions(); +options.setSourceFile(sourceFileInfo); +options.addTargetFilesItem(targetFileInfo); +options.setOutputPath("output/result.docx"); + +// First, get all changes +PostChangesRequest request = new PostChangesRequest(options); +List changes = apiInstance.postChanges(request); + +// Process the changes - in this example, we'll accept only the first change +for (ChangeInfo change : changes) { + change.setComparisonAction(ComparisonActionEnum.REJECT); +} + +// Accept just the first change +if (changes.size() > 0) { + changes.get(0).setComparisonAction(ComparisonActionEnum.ACCEPT); +} + +// Update the options with our decision +options.setChanges(changes); + +// Generate the result document +Link response = apiInstance.putChangesDocument(new PutChangesDocumentRequest(options)); + +System.out.println("Output file link: " + response.getHref()); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source.docx" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target.docx" +options = groupdocs_comparison_cloud.UpdatesOptions() +options.source_file = source +options.target_files = [target] +options.output_path = "output/result.docx" + +# First, get all changes +changes = api_instance.post_changes(groupdocs_comparison_cloud.PostChangesRequest(options)) + +# Process the changes - in this example, we'll accept only the first change +for change in changes: + change.comparison_action = "Reject" + +# Accept just the first change +if len(changes) > 0: + changes[0].comparison_action = "Accept" + +# Update the options with our decision +options.changes = changes + +# Generate the result document +response = api_instance.put_changes_document(groupdocs_comparison_cloud.PutChangesDocumentRequest(options)) + +print("Output file link: " + response.href) +``` + +## Advanced Usage Scenarios + +### Selective Change Filtering + +In practice, you might want to be more selective about which changes to accept or reject. For example, you might want to: + +1. Accept all changes by a specific author: +```csharp +foreach (var change in changes) +{ + // Set default action to reject + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Reject; + + // Accept changes made by a specific author + if (change.Authors != null && change.Authors.Contains("John Doe")) + { + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Accept; + } +} +``` + +2. Accept only certain types of changes: +```csharp +foreach (var change in changes) +{ + // Reject by default + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Reject; + + // Accept only insertions + if (change.Type == "Inserted") + { + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Accept; + } +} +``` + +3. Accept changes based on content: +```csharp +foreach (var change in changes) +{ + // Reject by default + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Reject; + + // Accept changes containing specific text + if (change.Text != null && change.Text.Contains("important clause")) + { + change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Accept; + } +} +``` + +## Common Issues and Troubleshooting + +1. Change IDs Mismatch: Ensure that the change IDs you reference in the `updates` call match exactly with the IDs returned by the `changes` call. If you provide an invalid ID, the API will return an error. + +2. Missing Changes: If you don't explicitly specify a comparison action for a change, it defaults to "None", which means the change won't be included in the final document. Always set a specific action for each change. + +3. Document Format Limitations: Some document formats may have limitations in how changes can be applied. Test your specific document formats to understand any constraints. + +4. Large Documents: For documents with a large number of changes, consider processing changes in batches to improve performance and user experience. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What are the possible values for the `comparisonAction` property? +2. What is the default action if you don't specify a `comparisonAction` for a change? +3. What API endpoints are involved in the accept/reject workflow? +4. How can you selectively accept changes based on criteria like author or content? + +## What You've Learned + +In this tutorial, you've learned how to: +- Retrieve a list of changes between document versions +- Selectively mark changes for acceptance or rejection +- Generate a final document that incorporates only the accepted changes +- Implement advanced filtering for changes based on various criteria + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a user interface that displays each change and allows users to accept or reject them one by one +2. Implement a batch processing feature for accepting or rejecting multiple changes based on common criteria +3. Add a preview function that shows how the document will look after applying accept/reject decisions +4. Create a change history log that tracks which changes were accepted or rejected and by whom + +## Next Steps + +Now that you've learned to accept or reject document changes, check out these related tutorials: +- [Tutorial: How to Get Change Coordinates](/advanced-features/get-changes-coordinates/) +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) +- [Tutorial: How to Work with Document Revisions](/advanced-features/get-list-of-revisions/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/accept-reject-revisions/_index.md b/content/comparison/english/advanced-features/accept-reject-revisions/_index.md new file mode 100644 index 0000000..9c856fb --- /dev/null +++ b/content/comparison/english/advanced-features/accept-reject-revisions/_index.md @@ -0,0 +1,377 @@ +--- +title: How to Accept or Reject Revisions Tutorial +description: Learn to selectively accept or reject specific revisions in Word documents using GroupDocs.Comparison Cloud API in this comprehensive tutorial +weight: 30 +url: /advanced-features/accept-reject-revisions/ +--- + +# Tutorial: How to Accept or Reject Revisions + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Selectively accept or reject specific revisions in Word documents +- Process a list of revisions with individual accept/reject decisions +- Generate a final document that incorporates your revision decisions + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Word documents with tracked changes (revisions) ready in your cloud storage + +## The Practical Scenario + +Imagine you're managing a legal team that reviews contract revisions. You've received a Word document with numerous tracked changes from different team members. Before finalizing the document, you need to review each revision and decide whether to accept or reject it based on its merit. Some revisions improve the contract, while others introduce problematic terms or formatting. + +With GroupDocs.Comparison Cloud API, you can programmatically: +1. Retrieve all tracked changes (revisions) in the document +2. Selectively mark each revision for acceptance or rejection +3. Generate a final document with only the approved revisions incorporated + +This approach allows precise control over document revisions in workflows that require careful review of proposed changes. + +## Understanding the Accept/Reject Revisions Process + +The process involves three main API calls: + +1. First, you call the `revisions` endpoint with a POST request to get a list of all revisions in the document +2. Then, for each revision, you set an `action` value: + - `Accept` - to include the revision in the final document + - `Reject` - to exclude the revision from the final document +3. Finally, you call the `revisions` endpoint with a PUT request, including your modified revisions list, to generate the final document + +## Step 1: Upload Your Document to Cloud Storage + +Before processing revisions, you need to upload a Word document with tracked changes to cloud storage. For this tutorial, we'll work with: +- source_with_revs.docx (a document with track changes enabled and several revisions) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Get the List of Revisions + +First, retrieve all revisions from the document: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/revisions" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FilePath': 'source_files/word/source_with_revs.docx' + }" +``` + +The API will return a JSON array containing all revisions in the document, which will look similar to this: + +```json +[ + { + "id": 0, + "action": "None", + "text": "\rsssssssss", + "author": "GroupDocs", + "type": "Insertion" + }, + { + "id": 1, + "action": "None", + "text": "Many students, scholars and members of the Christian clergy speak Latin fluently...", + "author": "GroupDocs", + "type": "Deletion" + } +] +``` + +## Step 4: Apply Accept/Reject Decisions + +Now, let's apply our decisions to the revisions. In this example, we'll accept specific revisions based on their IDs: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/revisions" \ +-X PUT \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_with_revs.docx' + }, + 'Revisions': [ + { + 'Id': 0, + 'action': 'Accept' + }, + { + 'Id': 1, + 'action': 'Accept' + } + ], + 'OutputPath': 'output/result.docx' +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 5: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains the original document with revisions accepted or rejected according to your decisions. + +## Try It Yourself + +Now it's your turn to implement selective revision acceptance in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new ReviewApi(configuration); + +var options = new ApplyRevisionsOptions +{ + SourceFile = new FileInfo {FilePath = "source_files/word/source_with_revs.docx" }, + OutputPath = "output/result.docx" +}; + +// Get all revisions from the document +var revisions = apiInstance.GetRevisions(new GetRevisionsRequest(options.SourceFile)); + +// In this example, we'll accept all revisions +foreach (var revision in revisions) + revision.Action = RevisionInfo.ActionEnum.Accept; + +// Alternatively, you could be selective: +// revisions[0].Action = RevisionInfo.ActionEnum.Accept; +// revisions[1].Action = RevisionInfo.ActionEnum.Reject; + +// Update the options with our decisions +options.Revisions = revisions; + +// Generate the result document +var response = apiInstance.ApplyRevisions(new ApplyRevisionsRequest(options)); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +ReviewApi apiInstance = new ReviewApi(configuration); + +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source_with_revs.docx"); + +ApplyRevisionsOptions options = new ApplyRevisionsOptions(); +options.setSourceFile(sourceFileInfo); +options.setOutputPath("output/result.docx"); + +// Get all revisions from the document +GetRevisionsRequest request = new GetRevisionsRequest(sourceFileInfo); +List revisions = apiInstance.getRevisions(request); + +// In this example, we'll accept all revisions +for (RevisionInfo revision : revisions) { + revision.setAction(ActionEnum.ACCEPT); +} + +// Alternatively, you could be selective: +// revisions.get(0).setAction(ActionEnum.ACCEPT); +// revisions.get(1).setAction(ActionEnum.REJECT); + +// Update the options with our decisions +options.setRevisions(revisions); + +// Generate the result document +Link response = apiInstance.applyRevisions(new ApplyRevisionsRequest(options)); + +System.out.println("Output file link: " + response.getHref()); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source_with_revs.docx" +options = groupdocs_comparison_cloud.ApplyRevisionsOptions() +options.source_file = source +options.output_path = "output/result.docx" + +# Get all revisions from the document +revisions = api_instance.get_revisions(groupdocs_comparison_cloud.GetRevisionsRequest(source)) + +# In this example, we'll accept all revisions +for revision in revisions: + revision.action = "Accept" + +# Alternatively, you could be selective: +# revisions[0].action = "Accept" +# revisions[1].action = "Reject" + +# Update the options with our decisions +options.revisions = revisions + +# Generate the result document +response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options)) + +print("Output file link: " + response.href) +``` + +## Advanced Usage Scenarios + +### Selective Revision Filtering + +In practice, you'll often want to be more selective about which revisions to accept or reject. Here are some common approaches: + +1. Accept or reject by author: +```csharp +foreach (var revision in revisions) +{ + // Set default action to reject + revision.Action = RevisionInfo.ActionEnum.Reject; + + // Accept revisions made by a specific author + if (revision.Author == "John Doe") + { + revision.Action = RevisionInfo.ActionEnum.Accept; + } +} +``` + +2. Accept or reject by revision type: +```csharp +foreach (var revision in revisions) +{ + // Reject by default + revision.Action = RevisionInfo.ActionEnum.Reject; + + // Accept only insertions + if (revision.Type == "Insertion") + { + revision.Action = RevisionInfo.ActionEnum.Accept; + } +} +``` + +3. Accept or reject based on content: +```csharp +foreach (var revision in revisions) +{ + // Reject by default + revision.Action = RevisionInfo.ActionEnum.Reject; + + // Accept revisions containing specific text + if (revision.Text != null && revision.Text.Contains("important clause")) + { + revision.Action = RevisionInfo.ActionEnum.Accept; + } +} +``` + +### Creating a Review Workflow + +For a more robust revision review workflow, consider implementing these features: + +1. Batch Processing: Allow users to apply rules to accept or reject revisions in batch (e.g., "Accept all insertions") + +2. Two-Step Review: Implement a preliminary automatic filtering based on rules, followed by manual review of edge cases + +3. Commenting: Add comments to the document explaining why certain revisions were accepted or rejected + +4. Revision History: Maintain a log of which revisions were accepted or rejected and by whom + +## Common Issues and Troubleshooting + +1. Revision IDs Mismatch: Ensure that the revision IDs you reference in the `ApplyRevisions` call match exactly with the IDs returned by the `GetRevisions` call. If you provide an invalid ID, the API will return an error. + +2. Missing Action: If you don't explicitly specify an action for a revision, it defaults to "None", which means the revision's status won't be changed. Always set a specific action for each revision you want to process. + +3. Document Format Limitations: This feature is primarily designed for Word documents (.docx, .doc). Other formats may not support revision tracking or may have limited support. + +4. Large Documents: For documents with a large number of revisions, consider processing revisions in batches to improve performance and user experience. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What are the possible values for the `action` property of a revision? +2. What is the default action if you don't specify an action for a revision? +3. What API endpoints are involved in the accept/reject revisions workflow? +4. How can you selectively accept revisions based on criteria like author or content? + +## What You've Learned + +In this tutorial, you've learned how to: +- Retrieve a list of revisions from a Word document +- Selectively mark revisions for acceptance or rejection +- Generate a final document that incorporates your revision decisions +- Implement advanced filtering for revisions based on various criteria + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a user interface that displays each revision and allows users to accept or reject them one by one +2. Implement a batch processing feature for accepting or rejecting multiple revisions based on common criteria +3. Add a preview function that shows how the document will look after applying accept/reject decisions +4. Create a revision history log that tracks which revisions were accepted or rejected and by whom + +## Next Steps + +Now that you've learned to selectively accept or reject revisions, check out these related tutorials: +- [Tutorial: How to Accept All Revisions](/advanced-features/accept-all-revisions/) +- [Tutorial: How to Reject All Revisions](/advanced-features/reject-all-revisions/) +- [Tutorial: How to Accept or Reject Document Changes](/advanced-features/accept-reject-document-changes/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/compare-multiple-documents/_index.md b/content/comparison/english/advanced-features/compare-multiple-documents/_index.md new file mode 100644 index 0000000..4469872 --- /dev/null +++ b/content/comparison/english/advanced-features/compare-multiple-documents/_index.md @@ -0,0 +1,222 @@ +--- +title: How to Compare Multiple Documents Tutorial +description: Learn to compare more than two documents simultaneously using GroupDocs.Comparison Cloud API with this step-by-step tutorial for developers +weight: 40 +url: /advanced-features/compare-multiple-documents/ +--- + +# Tutorial: How to Compare Multiple Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Compare more than two documents simultaneously using GroupDocs.Comparison Cloud API +- Configure specific comparison settings for multiple document comparison +- Generate a comprehensive report highlighting differences across multiple files + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're working with a team on a contract document that has gone through multiple revisions. You need to compare the original document with three different revised versions to identify all changes, additions, and deletions across all document versions. Manually checking would be time-consuming and error-prone, but GroupDocs.Comparison Cloud API makes this process straightforward. + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. In this tutorial, we'll work with four documents: +- source.docx (the original document) +- target.docx (first revision) +- target_1.docx (second revision) +- target_2.docx (third revision) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Multiple Documents + +Now let's compare the source document with all three target documents. We'll customize the appearance of inserted items by changing the font color to red (16711680 in decimal color code): + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + }, + { + 'FilePath': 'target_files/word/target_1.docx' + }, + { + 'FilePath': 'target_files/word/target_2.docx' + } + ], + 'OutputPath': 'output/result.docx', + 'Settings': { + 'InsertedItemsStyle': { + 'FontColor': '16711680' + } + } +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains all differences between the source document and all three target documents, with inserted content highlighted in red as specified in our settings. + +## Try It Yourself + +Now it's your turn to implement multiple document comparison in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + }, + new FileInfo { + FilePath = "target_files/word/target_1.docx" + }, + new FileInfo { + FilePath = "target_files/word/target_2.docx" + } + }, + Settings = new Settings { + InsertedItemsStyle = new ItemsStyle + { + FontColor = "16711680" + } + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source.docx" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target.docx" +target1 = groupdocs_comparison_cloud.FileInfo() +target1.file_path = "target_files/word/target_1.docx" +target2 = groupdocs_comparison_cloud.FileInfo() +target2.file_path = "target_files/word/target_2.docx" +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target, target1, target2] +options.output_path = "output/result.docx" +settings = groupdocs_comparison_cloud.Settings() +settings.inserted_items_style = groupdocs_comparison_cloud.ItemsStyle() +settings.inserted_items_style.font_color = "16711680" +options.settings = settings + +request = groupdocs_comparison_cloud.ComparisonsRequest(options) +response = api_instance.comparisons(request) + +print("Output file link: " + response.href) +``` + +## Common Issues and Troubleshooting + +1. Authentication Error: Ensure your Client ID and Client Secret are correct and that your token hasn't expired. + +2. File Not Found: Verify the file paths for your source and target documents. The paths should be relative to your cloud storage root. + +3. Comparison Takes Too Long: When comparing very large documents or many documents simultaneously, the operation may take longer. Consider implementing asynchronous processing for better user experience. + +4. Memory Issues: If you encounter memory-related errors when processing large documents, try optimizing your code or consider upgrading your service plan. + +## What You've Learned + +In this tutorial, you've learned how to: +- Compare multiple documents simultaneously using GroupDocs.Comparison Cloud API +- Apply custom styling to highlight inserted content +- Process the API response to obtain the resulting document + +## Further Practice + +To reinforce your learning, try these exercises: +1. Compare documents of different formats (e.g., DOCX, PDF, XLSX) +2. Experiment with different style settings for various change types +3. Implement a solution that allows users to select which documents to compare dynamically + +## Next Steps + +Now that you've learned to compare multiple documents, check out these related tutorials: + +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/compare-multiple-password-protected/_index.md b/content/comparison/english/advanced-features/compare-multiple-password-protected/_index.md new file mode 100644 index 0000000..edb4a84 --- /dev/null +++ b/content/comparison/english/advanced-features/compare-multiple-password-protected/_index.md @@ -0,0 +1,269 @@ +--- +title: How to Compare Multiple Password-Protected Documents Tutorial +description: Learn to compare multiple password-protected documents simultaneously using GroupDocs.Comparison Cloud API with this comprehensive tutorial +weight: 50 +url: /advanced-features/compare-multiple-password-protected/ +--- + +# Tutorial: How to Compare Multiple Password-Protected Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Compare multiple documents that are secured with passwords +- Properly provide multiple password credentials in API requests +- Process and understand comparison results from multiple secure documents + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Multiple password-protected documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're a legal professional reviewing multiple versions of a confidential contract. You have four password-protected document versions: +- The original contract (source_protected.docx) +- Three revised versions (target_protected.docx, target_1_protected.docx, target_2_protected.docx) + +You need to compare all versions simultaneously to identify all changes while maintaining document security. GroupDocs.Comparison Cloud API provides a streamlined way to accomplish this task. + +## Step 1: Upload Your Password-Protected Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source_protected.docx (protected with password: "1231") +- target_protected.docx (protected with password: "5784") +- target_1_protected.docx (protected with password: "5784") +- target_2_protected.docx (protected with password: "5784") + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Multiple Password-Protected Documents + +Now let's compare all four password-protected documents. Notice how we include the passwords for each document in the API request: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_protected.docx', + 'Password': '1231' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target_protected.docx', + 'Password': '5784' + }, + { + 'FilePath': 'target_files/word/target_1_protected.docx', + 'Password': '5784' + }, + { + 'FilePath': 'target_files/word/target_2_protected.docx', + 'Password': '5784' + } + ], + 'OutputPath': 'output/result.docx' +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains all differences between the source document and all three target documents. The comparison result highlights additions, deletions, and modifications across all documents, providing a comprehensive view of all changes. + +## Try It Yourself + +Now it's your turn to implement multiple password-protected document comparison in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source_protected.docx", + Password = "1231" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target_protected.docx", + Password = "5784" + }, + new FileInfo { + FilePath = "target_files/word/target_1_protected.docx", + Password = "5784" + }, + new FileInfo { + FilePath = "target_files/word/target_2_protected.docx", + Password = "5784" + } + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.compareApi = comparison_cloud.CompareApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source_protected.docx"; + source.password = "1231"; + let target = new comparison_cloud.FileInfo(); + target.filePath = "target_files/word/target_protected.docx"; + target.password = "5784"; + let target1 = new comparison_cloud.FileInfo(); + target1.filePath = "target_files/word/target_1_protected.docx"; + target1.password = "5784"; + let target2 = new comparison_cloud.FileInfo(); + target2.filePath = "target_files/word/target_2_protected.docx"; + target2.password = "5784"; + + let options = new comparison_cloud.ComparisonOptions(); + options.sourceFile = source; + options.targetFiles = [target, target1, target2]; + options.outputPath = "output/result.docx"; + + let request = new comparison_cloud.ComparisonsRequest(options); + + let response = await compareApi.comparisons(request); + console.log("Output file link: " + response.href); +} catch (error) { + console.log(error.message); +} +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source_protected.docx" +source.password = "1231" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target_protected.docx" +target.password = "5784" +target1 = groupdocs_comparison_cloud.FileInfo() +target1.file_path = "target_files/word/target_1_protected.docx" +target1.password = "5784" +target2 = groupdocs_comparison_cloud.FileInfo() +target2.file_path = "target_files/word/target_2_protected.docx" +target2.password = "5784" +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target, target1, target2] +options.output_path = "output/result.docx" + +request = groupdocs_comparison_cloud.ComparisonsRequest(options) +response = api_instance.comparisons(request) + +print("Output file link: " + response.href) +``` + +## Common Issues and Troubleshooting + +1. Incorrect Password Errors: If you provide an incorrect password for any document, the comparison will fail. Double-check all passwords before submitting the request. + +2. File Not Found: Verify the file paths for all documents. The paths should be relative to your cloud storage root. + +3. Handling Multiple Documents: When comparing multiple documents, the API processes each target document against the source. The result contains changes from all target documents, which can be complex to interpret. Consider using styled output (see our [Customize Change Styles](/advanced-features/customize-changes-styles/) tutorial) to differentiate changes from different documents. + +4. Performance Considerations: Comparing multiple password-protected documents requires more processing power and may take longer than comparing unprotected documents. Consider implementing asynchronous processing for better user experience. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. How do you specify passwords for multiple target documents in the API request? +2. Does each target document need to have the same password? +3. How can you make the result document more readable when comparing multiple documents? + +## What You've Learned + +In this tutorial, you've learned how to: +- Compare multiple documents that are secured with passwords +- Properly provide multiple password credentials in API requests +- Process and understand comparison results from multiple secure documents + +## Further Practice + +To reinforce your learning, try these exercises: +1. Compare multiple password-protected documents of different formats (e.g., DOCX, PDF, XLSX) +2. Implement custom styling to distinguish changes from different target documents +3. Create a workflow that secures the result document with a new password + +## Next Steps + +Now that you've learned to compare multiple password-protected documents, check out these related tutorials: +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) +- [Tutorial: How to Set Password for Result Document](/advanced-features/set-password-for-resultant-document/) +- [Tutorial: How to Get List of Changes](/advanced-features/get-list-of-changes/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/compare-password-protected/_index.md b/content/comparison/english/advanced-features/compare-password-protected/_index.md new file mode 100644 index 0000000..c338126 --- /dev/null +++ b/content/comparison/english/advanced-features/compare-password-protected/_index.md @@ -0,0 +1,203 @@ +--- +title: How to Compare Password-Protected Documents Tutorial +description: Learn to securely compare password-protected documents using GroupDocs.Comparison Cloud API with this comprehensive step-by-step tutorial +weight: 60 +url: /advanced-features/compare-password-protected/ +--- + +# Tutorial: How to Compare Password-Protected Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Compare documents that are protected with passwords +- Properly provide password credentials in API requests +- Understand security considerations when comparing confidential documents + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Password-protected source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Consider a scenario where you're working with confidential financial reports that are password-protected. You need to compare different versions of these reports to identify changes between them while maintaining the security of the documents. GroupDocs.Comparison Cloud API allows you to compare these password-protected documents without compromising their security. + +## Step 1: Upload Your Password-Protected Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source_protected.docx (protected with password: "1231") +- target_protected.docx (protected with password: "5784") + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Password-Protected Documents + +Now let's compare the password-protected documents. Notice how we include the passwords in the API request: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_protected.docx', + 'Password': '1231' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target_protected.docx', + 'Password': '5784' + } + ], + 'OutputPath': 'output/result.docx' +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Download and Review the Result + +Use the link from the response to download the resulting document. This file contains all differences between the password-protected source and target documents. Note that the result document is not password-protected by default. If you want to secure the result document, refer to our tutorial on [setting a password for the result document](/advanced-features/set-password-for-resultant-document/). + +## Try It Yourself + +Now it's your turn to implement password-protected document comparison in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source_protected.docx", + Password = "1231" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target_protected.docx", + Password = "5784" + } + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +CompareApi apiInstance = new CompareApi(configuration); + +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source_protected.docx"); +sourceFileInfo.setPassword("1231"); +FileInfo targetFileInfo = new FileInfo(); +targetFileInfo.setFilePath("target_files/word/target_protected.docx"); +targetFileInfo.setPassword("5784"); + +ComparisonOptions options = new ComparisonOptions(); +options.setSourceFile(sourceFileInfo); +options.addTargetFilesItem(targetFileInfo); +options.setOutputPath("output/result.docx"); + +ComparisonsRequest request = new ComparisonsRequest(options); +Link response = apiInstance.comparisons(request); + +System.out.println("Output file link: " + response.getHref()); +``` + +## Common Issues and Troubleshooting + +1. Incorrect Password Error: If you provide an incorrect password, you'll receive an error. Double-check your passwords and ensure they match those used to secure the documents. + +2. File Not Found: Verify the file paths for your source and target documents. The paths should be relative to your cloud storage root. + +3. Password Required: If you attempt to compare a password-protected document without providing a password, the API will return an error indicating that a password is required. + +4. Security Considerations: Remember that the passwords are sent in the API request. Always use HTTPS connections to ensure secure transmission of this sensitive information. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What property do you use to provide a password for a document in the API request? +2. Does the result document inherit password protection from the source or target documents? +3. Why is it important to use HTTPS when sending requests with document passwords? + +## What You've Learned + +In this tutorial, you've learned how to: +- Compare documents that are protected with passwords +- Properly provide password credentials in API requests +- Understand security considerations when comparing confidential documents + +## Further Practice + +To reinforce your learning, try these exercises: +1. Compare password-protected documents of different formats (e.g., DOCX, PDF, XLSX) +2. Create a workflow that secures the result document with a new password +3. Implement error handling for cases where incorrect passwords are provided + +## Next Steps + +Now that you've learned to compare password-protected documents, check out these related tutorials: +- [Tutorial: How to Compare Multiple Password-Protected Documents](/advanced-features/compare-multiple-password-protected/) +- [Tutorial: How to Set Password for Result Document](/advanced-features/set-password-for-resultant-document/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/compare-sensitivity/_index.md b/content/comparison/english/advanced-features/compare-sensitivity/_index.md new file mode 100644 index 0000000..84e8c8f --- /dev/null +++ b/content/comparison/english/advanced-features/compare-sensitivity/_index.md @@ -0,0 +1,226 @@ +--- +title: How to Adjust Comparison Sensitivity Tutorial +description: Learn to fine-tune document comparison precision by adjusting sensitivity settings in GroupDocs.Comparison Cloud API with this step-by-step tutorial +weight: 70 +url: /advanced-features/compare-sensitivity/ +--- + +# Tutorial: How to Adjust Comparison Sensitivity + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Adjust comparison sensitivity to balance speed and accuracy +- Understand how sensitivity values affect comparison results +- Configure the optimal sensitivity for different document types and comparison needs + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're developing a contract review application where users need to compare different versions of legal documents. Some users need quick comparisons to spot major changes, while others require thorough analysis that identifies even the smallest differences. By understanding and implementing comparison sensitivity settings, you can provide both options in your application. + +## Understanding Comparison Sensitivity + +GroupDocs.Comparison Cloud allows you to adjust the comparison sensitivity to achieve an optimal balance between comparison speed and accuracy. The sensitivity value ranges from 0 to 100: + +- Minimal Value (0): Provides the fastest comparison speed but may produce lower quality results. With this setting, if there is at least one common letter in two compared words, these words will not be treated as fully inserted and deleted. + +- Default Value (75): This balanced setting means comparison occurs when the percentage of deleted or inserted elements in relation to all elements does not exceed 75%. + +- Maximum Value (100): Comparison occurs at any length of a common sub-sequence of two compared objects. This provides the highest quality but slowest comparison speed. + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Documents with Adjusted Sensitivity + +Let's compare the documents with maximum sensitivity (100) to ensure we catch every difference: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'OutputPath': 'output/result.docx', + 'Settings': { + 'SensitivityOfComparison': 100 + } +}" +``` + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Experiment with Different Sensitivity Values + +To understand how sensitivity affects your specific documents, try comparing them with different sensitivity values: + +1. Low Sensitivity (25): Will identify only major changes and provide faster results +2. Medium Sensitivity (50): A balanced approach suitable for most comparisons +3. High Sensitivity (75): The default setting, good for detailed comparisons +4. Maximum Sensitivity (100): Will identify every possible difference, but may be slower + +For each test, modify the "SensitivityOfComparison" value in your API request and compare the results. + +## Try It Yourself + +Now it's your turn to implement adjustable comparison sensitivity in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + } + }, + Settings = new Settings { + SensitivityOfComparison = 100 + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +CompareApi apiInstance = new CompareApi(configuration); + +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source.docx"); +FileInfo targetFileInfo = new FileInfo(); +targetFileInfo.setFilePath("target_files/word/target.docx"); + +Settings settings = new Settings(); +settings.setSensitivityOfComparison(100); + +ComparisonOptions options = new ComparisonOptions(); +options.setSourceFile(sourceFileInfo); +options.addTargetFilesItem(targetFileInfo); +options.setSettings(settings); +options.setOutputPath("output/result.docx"); + +ComparisonsRequest request = new ComparisonsRequest(options); +Link response = apiInstance.comparisons(request); + +System.out.println("Output file link: " + response.getHref()); +``` + +## Common Issues and Troubleshooting + +1. Too Many Differences: If the comparison result shows too many minor differences that aren't relevant to your needs, try reducing the sensitivity value. + +2. Missing Differences: If the comparison doesn't identify changes you know exist, increase the sensitivity value to catch more subtle differences. + +3. Performance Issues: High sensitivity values (especially 100) may cause slower performance with very large documents. Consider using a lower sensitivity value for initial quick comparisons and higher values for detailed analysis. + +4. Format-Specific Behavior: Different document formats might respond differently to sensitivity settings. Test with your specific document types to find the optimal settings. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What is the range of possible sensitivity values? +2. How does a higher sensitivity value affect comparison quality and speed? +3. What sensitivity value would you use for a quick overview of major changes? +4. What is the default sensitivity value in GroupDocs.Comparison Cloud? + +## What You've Learned + +In this tutorial, you've learned how to: +- Adjust comparison sensitivity to balance speed and accuracy +- Understand how sensitivity values affect comparison results +- Configure the optimal sensitivity for different document types and comparison needs + +## Further Practice + +To reinforce your learning, try these exercises: +1. Compare the same pair of documents with sensitivity values of 25, 50, 75, and 100, and observe the differences in the results +2. Create a test with documents that have minor spelling changes to see how different sensitivity values affect their detection +3. Develop a function that automatically selects the appropriate sensitivity based on document size and user requirements + +## Next Steps + +Now that you've learned to adjust comparison sensitivity, check out these related tutorials: +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) +- [Tutorial: How to Get List of Changes](/advanced-features/get-list-of-changes/) +- [Tutorial: How to Get Change Coordinates](/advanced-features/get-changes-coordinates/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/customize-changes-styles/_index.md b/content/comparison/english/advanced-features/customize-changes-styles/_index.md new file mode 100644 index 0000000..a1bd9d9 --- /dev/null +++ b/content/comparison/english/advanced-features/customize-changes-styles/_index.md @@ -0,0 +1,275 @@ +--- +title: How to Customize Change Styles Tutorial +description: Learn to customize the appearance of different change types in document comparisons using GroupDocs.Comparison Cloud API in this detailed tutorial +weight: 80 +url: /advanced-features/customize-changes-styles/ +--- + +# Tutorial: How to Customize Change Styles + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Customize the visual appearance of different change types in document comparisons +- Configure styling options for inserted, deleted, and modified content +- Enhance the readability of comparison results through visual differentiation + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're preparing a document comparison for a legal review where multiple stakeholders need to quickly identify different types of changes. Default styling might not provide enough visual distinction between insertions, deletions, and modifications. By customizing change styles, you can make the comparison result more intuitive and easier to analyze. + +## Understanding Change Style Options + +GroupDocs.Comparison Cloud API allows you to customize the appearance of three types of changes: + +1. InsertedItemsStyle - Controls the appearance of content that has been added +2. DeletedItemsStyle - Controls the appearance of content that has been removed +3. ChangedItemsStyle - Controls the appearance of content that has been modified + +For each change type, you can customize: +- FontColor - The color of the text (using decimal RGB color values) +- HighlightColor - The background color behind the text +- Bold - Whether the text appears in bold +- Italic - Whether the text appears in italic +- Underline - Whether the text is underlined +- StrikeThrough - Whether the text has a line through it + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Documents with Custom Styles + +Now let's compare the documents with custom change styles: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'OutputPath': 'output/result.docx', + 'Settings': { + 'InsertedItemsStyle': { + 'HighlightColor': '14297642', + 'FontColor': '5102122', + 'Underline': true + }, + 'DeletedItemsStyle': { + 'FontColor': '14166746', + 'Bold': true + }, + 'ChangedItemsStyle': { + 'FontColor': '14320170', + 'Italic': true + } + } +}" +``` + +In this example: +- Inserted content appears with a light blue highlight, green text, and underlined +- Deleted content appears in red text and bold +- Changed content appears in blue text and italic + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains all differences between the source and target documents, styled according to your custom settings. Review how the different change types appear and adjust the styling if needed for better visibility. + +## Understanding Color Values + +The API uses decimal color values for both FontColor and HighlightColor. Here are some common colors and their decimal values: + +- Red: 16711680 or 14166746 (darker red) +- Green: 65280 or 5102122 (darker green) +- Blue: 255 or 14320170 (darker blue) +- Yellow: 16776960 +- Purple: 16711935 +- Teal: 65535 +- Black: 0 +- White: 16777215 + +## Try It Yourself + +Now it's your turn to implement custom change styles in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); + +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + } + }, + Settings = new Settings { + InsertedItemsStyle = new ItemsStyle + { + HighlightColor = "14297642", // Light blue + FontColor = "5102122", // Dark green + Underline = true, + }, + DeletedItemsStyle = new ItemsStyle + { + FontColor = "14166746", // Dark red + Bold = true, + }, + ChangedItemsStyle = new ItemsStyle + { + FontColor = "14320170", // Dark blue + Italic = true, + }, + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source.docx" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target.docx" +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target] +options.output_path = "output/result.docx" +settings = groupdocs_comparison_cloud.Settings() +settings.inserted_items_style = groupdocs_comparison_cloud.ItemsStyle() +settings.inserted_items_style.highlight_color = "14297642" # Light blue +settings.inserted_items_style.font_color = "5102122" # Dark green +settings.inserted_items_style.underline = True +settings.deleted_items_style = groupdocs_comparison_cloud.ItemsStyle() +settings.deleted_items_style.font_color = "14166746" # Dark red +settings.deleted_items_style.bold = True +settings.changed_items_style = groupdocs_comparison_cloud.ItemsStyle() +settings.changed_items_style.font_color = "14320170" # Dark blue +settings.changed_items_style.italic = True +options.settings = settings + +request = groupdocs_comparison_cloud.ComparisonsRequest(options) +response = api_instance.comparisons(request) + +print("Output file link: " + response.href) +``` + +## Common Issues and Troubleshooting + +1. Incorrect Color Values: Color values must be provided as strings containing decimal RGB values. If you see unexpected colors, double-check your color values. + +2. Style Not Applied: If your custom styles aren't appearing in the result document, ensure that your settings object is properly structured and that all property names match exactly as shown in the examples. + +3. Format Compatibility: Some style features may not be fully supported in all document formats. Test your style settings with the specific document formats you're using. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. Which three change types can you style in GroupDocs.Comparison Cloud? +2. What properties can you customize for each change type? +3. How are color values represented in the API? + +## What You've Learned + +In this tutorial, you've learned how to: +- Customize the visual appearance of different change types in document comparisons +- Configure styling options for inserted, deleted, and modified content +- Enhance the readability of comparison results through visual differentiation + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create style configurations optimized for different use cases (legal review, editorial review, code review) +2. Experiment with different color combinations to find the most effective visual distinction +3. Create a user interface that allows users to customize styles before comparison + +## Next Steps + +Now that you've learned to customize change styles, check out these related tutorials: +- [Tutorial: How to Adjust Comparison Sensitivity](/advanced-features/compare-sensitivity/) +- [Tutorial: How to Get List of Changes](/advanced-features/get-list-of-changes/) +- [Tutorial: How to Compare Multiple Documents](/advanced-features/compare-multiple-documents/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/get-changes-coordinates/_index.md b/content/comparison/english/advanced-features/get-changes-coordinates/_index.md new file mode 100644 index 0000000..1afa4c5 --- /dev/null +++ b/content/comparison/english/advanced-features/get-changes-coordinates/_index.md @@ -0,0 +1,274 @@ +--- +title: How to Get Change Coordinates Tutorial +description: Learn to detect the exact spatial location of document changes using GroupDocs.Comparison Cloud API in this comprehensive step-by-step tutorial +weight: 90 +url: /advanced-features/get-changes-coordinates/ +--- + +# Tutorial: How to Get Change Coordinates + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Detect the precise spatial location of changes within document pages +- Retrieve coordinate information for all changes between source and target documents +- Use coordinate data for advanced visualization and integration scenarios + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Consider developing an advanced document review application that not only identifies changes between document versions but also displays them in a custom interface. You want to: + +1. Create a document viewer with visual indicators precisely placed where changes occur +2. Implement an interactive navigation system that jumps to specific changes +3. Generate thumbnails with change highlights at exact positions +4. Support zooming to change locations with proper scaling + +To accomplish these features, you need to know exactly where each change appears on the document page. GroupDocs.Comparison Cloud API provides coordinate information for each detected change, making these advanced visualizations possible. + +## Understanding Change Coordinates + +When you enable coordinate calculation, each change detected by the API includes: + +- PageInfo: Contains information about the page: + - Width and height of the page + - Page number where the change appears + +- Box: Contains the spatial coordinates of the change: + - X and Y: The position (in points) of the change from the top-left corner of the page + - Width and height: The dimensions of the area occupied by the change + +These coordinates use a coordinate system where (0,0) is at the top-left corner of the page, with X increasing to the right and Y increasing downward. + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Get Changes with Coordinates + +To retrieve changes with their coordinates, we need to set the `CalculateComponentCoordinates` option to `true` in our API request: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/changes" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'Settings': { + 'CalculateComponentCoordinates': true + } +}" +``` + +The API will return a JSON array containing all detected changes, including their coordinates. Here's a sample response showing the coordinate information: + +```json +[ + { + "id": 0, + "comparisonAction": "None", + "type": "Inserted", + "text": "lol", + "targetText": "Latin (i/ˈlætɪn/, /ˈlætɪn/; Latin: lingua latīna, IPA: [ˈlɪŋɡʷa laˈtiːna]) is a classical language, originally spoken inLatium, Italy, which belongs to the Italic branch of the Indo-European languages.[3] The Latin alphabet is derived from the Etruscan and Greek alphabetslol.", + "authors": [ + "GroupDocs" + ], + "styleChangeInfo": [], + "pageInfo": { + "width": 612, + "height": 792, + "pageNumber": 1 + }, + "box": { + "height": 16.0934353, + "width": 14.0021219, + "x": 388.503021, + "y": 115.730377 + } + }, + // More changes... +] +``` + +## Step 4: Utilizing Coordinate Information + +Once you have the coordinate data, you can use it in various ways: + +1. Visual Overlays: Create visual indicators (like highlight boxes) positioned at the exact coordinates of each change in your document viewer. + +2. Interactive Navigation: Implement "jump to change" functionality that scrolls to the exact location of a selected change. + +3. Spatial Filtering: Filter changes based on their location within the document (e.g., changes in headers, footers, or specific sections). + +4. Scaling: Apply proper scaling to the coordinates when zooming in or out of the document view. + +## Try It Yourself + +Now it's your turn to implement change coordinate detection in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + } + }, + Settings = new Settings + { + CalculateComponentCoordinates = true + } +}; + +var request = new PostChangesRequest(options); +var changes = apiInstance.PostChanges(request); + +// Process the changes with coordinates +Console.WriteLine($"Total changes found: {changes.Count}"); +foreach (var change in changes.Take(3)) // Display first 3 changes +{ + Console.WriteLine($"Change ID: {change.Id}"); + Console.WriteLine($"Type: {change.Type}"); + Console.WriteLine($"Text: {change.Text}"); + Console.WriteLine($"Page Number: {change.PageInfo.PageNumber}"); + Console.WriteLine($"Position: X={change.Box.X}, Y={change.Box.Y}"); + Console.WriteLine($"Size: Width={change.Box.Width}, Height={change.Box.Height}"); + Console.WriteLine("---------------------"); +} +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source.docx" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target.docx" +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target] +settings = groupdocs_comparison_cloud.Settings() +settings.calculate_component_coordinates = True +options.settings = settings + +changes = api_instance.post_changes(groupdocs_comparison_cloud.PostChangesRequest(options)) + +# Process the changes with coordinates +print(f"Total changes found: {len(changes)}") +for i, change in enumerate(changes[:3]): # Display first 3 changes + print(f"Change ID: {change.id}") + print(f"Type: {change.type}") + print(f"Text: {change.text}") + print(f"Page Number: {change.page_info.page_number}") + print(f"Position: X={change.box.x}, Y={change.box.y}") + print(f"Size: Width={change.box.width}, Height={change.box.height}") + print("---------------------") +``` + +## Common Issues and Troubleshooting + +1. Missing Coordinate Information: If the coordinate information is missing or zeros, check that you've set `CalculateComponentCoordinates` to `true` in your request. + +2. Coordinate Scaling: The coordinates are provided in points (1/72 of an inch). If you're displaying the document at a different scale, remember to convert the coordinates accordingly. + +3. Different Document Formats: Different document formats might have varying precision in coordinate information. Test with your specific document types to understand any variations. + +4. Performance Considerations: Calculating coordinates requires additional processing. For very large documents, this might slightly increase the comparison time. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What setting do you need to enable to get coordinate information for changes? +2. What coordinate system is used for the change coordinates? +3. What information does the "PageInfo" object provide? +4. How can you use coordinate information in a document review application? + +## What You've Learned + +In this tutorial, you've learned how to: +- Detect the precise spatial location of changes within document pages +- Retrieve coordinate information for all changes between source and target documents +- Understand the structure of coordinate data +- Use coordinate data for advanced visualization and integration scenarios + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a simple HTML viewer that displays a document and overlays rectangles at the positions of detected changes +2. Implement a page thumbnail generator that highlights areas with changes +3. Build a function that groups changes by their proximity on the page +4. Develop a utility that converts change coordinates to different scale systems + +## Next Steps + +Now that you've learned to get change coordinates, check out these related tutorials: +- [Tutorial: How to Accept or Reject Document Changes](/advanced-features/accept-reject-document-changes/) +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) +- [Tutorial: How to Get List of Changes](/advanced-features/get-list-of-changes/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/get-list-of-changes/_index.md b/content/comparison/english/advanced-features/get-list-of-changes/_index.md new file mode 100644 index 0000000..31a26ae --- /dev/null +++ b/content/comparison/english/advanced-features/get-list-of-changes/_index.md @@ -0,0 +1,294 @@ +--- +title: How to Get a List of Changes from Comparisons Tutorial +description: Learn to programmatically retrieve and process all changes between documents using GroupDocs.Comparison Cloud API in this step-by-step tutorial +weight: 100 +url: /advanced-features/get-list-of-changes/ +--- + +# Tutorial: How to Get a List of Changes from Comparisons + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Retrieve a comprehensive list of all changes between source and target documents +- Understand the structure and properties of change information objects +- Process and analyze comparison results programmatically + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're developing a contract management system where legal teams need to track and review all changes between different versions of a document. While a visual comparison with highlighted changes is useful for manual review, programmatically accessing a structured list of changes enables you to: + +1. Build automated reports of all modifications +2. Implement custom approval workflows based on the type and extent of changes +3. Create statistics and analytics on document revisions +4. Integrate with other systems that need to process document changes + +GroupDocs.Comparison Cloud API provides a dedicated endpoint to retrieve a comprehensive list of all changes between documents, allowing you to implement these advanced features. + +## Understanding Change Information Objects + +Before we start implementing, let's understand what information is available in the change objects returned by the API: + +- ID: A unique identifier for each change +- Type: The type of change (Inserted, Deleted, Modified, etc.) +- Text: The affected text content +- TargetText: The text in the target document (for context) +- Authors: Who made the change (if available in the document) +- StyleChangeInfo: Information about style changes +- PageInfo: Information about the page where the change occurs +- Box: Coordinates of the change within the page (when requested) + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Get the List of Changes + +Now, let's retrieve the list of all changes between the source and target documents: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/changes" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ] +}" +``` + +The API will return a JSON array containing all identified changes between the documents. Here's a sample of what the response might look like: + +```json +[ + { + "id": 0, + "comparisonAction": "None", + "type": "Inserted", + "text": "lol", + "targetText": "Latin (i/ˈlætɪn/, /ˈlætɪn/; Latin: lingua latīna, IPA: [ˈlɪŋɡʷa laˈtiːna]) is a classical language, originally spoken inLatium, Italy, which belongs to the Italic branch of the Indo-European languages.[3] The Latin alphabet is derived from the Etruscan and Greek alphabetslol.", + "authors": [ + "GroupDocs" + ], + "styleChangeInfo": [], + "pageInfo": { + "width": 0, + "height": 0, + "pageNumber": 0 + }, + "box": { + "height": 0, + "width": 0, + "x": 0, + "y": 0 + } + }, + // More changes... +] +``` + +## Step 4: Get Changes with Coordinates + +If you need spatial information about where each change appears on the page, you can request coordinate data by setting the `CalculateComponentCoordinates` option to `true`: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/changes" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'Settings': { + 'CalculateComponentCoordinates': true + } +}" +``` + +With this option enabled, each change in the response will include precise coordinates in the `box` property and page dimensions in the `pageInfo` property: + +```json +"pageInfo": { + "width": 612, + "height": 792, + "pageNumber": 1 +}, +"box": { + "height": 16.0934353, + "width": 14.0021219, + "x": 388.503021, + "y": 115.730377 +} +``` + +These coordinates can be useful for creating custom visualizations or overlaying change information on document previews. + +## Try It Yourself + +Now it's your turn to implement change detection and analysis in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + } + } +}; + +var request = new PostChangesRequest(options); +var changes = apiInstance.PostChanges(request); + +// Process the changes +Console.WriteLine($"Total changes found: {changes.Count}"); +foreach (var change in changes.Take(5)) // Display first 5 changes +{ + Console.WriteLine($"Change ID: {change.Id}"); + Console.WriteLine($"Type: {change.Type}"); + Console.WriteLine($"Text: {change.Text}"); + Console.WriteLine("---------------------"); +} +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.compareApi = comparison_cloud.CompareApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source.docx"; + let target = new comparison_cloud.FileInfo(); + target.filePath = "target_files/word/target.docx"; + let options = new comparison_cloud.ComparisonOptions(); + options.sourceFile = source; + options.targetFiles = [target]; + + let request = new comparison_cloud.PostChangesRequest(options); + let changes = await compareApi.postChanges(request); + + console.log("Total changes found: " + changes.length); + + // Display the first 5 changes + for (let i = 0; i < Math.min(5, changes.length); i++) { + const change = changes[i]; + console.log("Change Type: " + change.type); + console.log("Text: " + change.text); + console.log("---------------------"); + } +} catch (error) { + console.log(error.message); +} +``` + +## Common Issues and Troubleshooting + +1. Large Documents: When working with very large documents, the list of changes might be extensive. Consider implementing pagination or filtering in your application to handle large result sets efficiently. + +2. Complex Formatting: Documents with complex formatting might generate many style-related changes. If you're only interested in content changes, you might need to filter the results to focus on insertions, deletions, and modifications. + +3. Performance Considerations: Getting the list of changes requires the API to perform a full comparison. For large documents, this operation might take some time. Consider implementing asynchronous processing for better user experience. + +4. Coordinate Calculation: Enabling the `CalculateComponentCoordinates` option provides valuable spatial information but might slightly increase processing time. Only enable this option when you need the coordinate data. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What API endpoint is used to retrieve the list of changes? +2. What types of changes can be detected by GroupDocs.Comparison Cloud? +3. How can you get the spatial coordinates of changes within the document pages? +4. What property would you use to identify who made a particular change? + +## What You've Learned + +In this tutorial, you've learned how to: +- Retrieve a comprehensive list of all changes between source and target documents +- Understand the structure and properties of change information objects +- Request spatial coordinates for more detailed change information +- Process and analyze comparison results programmatically + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a function that categorizes changes by type (insertions, deletions, modifications) +2. Implement a change filtering system based on author information +3. Develop a simple reporting tool that generates a summary of all changes +4. Create a visualization that maps changes to their locations in the document + +## Next Steps + +Now that you've learned to retrieve and process the list of changes, check out these related tutorials: +- [Tutorial: How to Get Change Coordinates](/advanced-features/get-changes-coordinates/) +- [Tutorial: How to Accept or Reject Document Changes](/advanced-features/accept-reject-document-changes/) +- [Tutorial: How to Customize Change Styles](/advanced-features/customize-changes-styles/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/get-list-of-revisions/_index.md b/content/comparison/english/advanced-features/get-list-of-revisions/_index.md new file mode 100644 index 0000000..423fdf3 --- /dev/null +++ b/content/comparison/english/advanced-features/get-list-of-revisions/_index.md @@ -0,0 +1,275 @@ +--- +title: How to Get a List of Revisions Tutorial +description: Learn to extract and process document revision history using GroupDocs.Comparison Cloud API in this comprehensive step-by-step tutorial +weight: 110 +url: /advanced-features/get-list-of-revisions/ +--- + +# Tutorial: How to Get a List of Revisions + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Retrieve the complete list of revisions from Word documents +- Access detailed information about each revision +- Process revision information programmatically + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Word documents with revisions (track changes) ready in your cloud storage + +## The Practical Scenario + +Imagine you're developing a document management system where legal teams need to track the history of changes in contracts. Microsoft Word's "Track Changes" feature is commonly used for collaborative editing, and your application needs to programmatically access this revision history. + +With GroupDocs.Comparison Cloud API, you can: +1. Extract all revisions tracked in Word documents +2. View details about each revision (who made it, what type of change, the affected text) +3. Build custom workflows for revision review and approval + +## Understanding Revisions in Word Documents + +When users enable the "Track Changes" feature in Microsoft Word, the document maintains a record of all modifications made to the content. These tracked changes are known as "revisions" and include: + +- Insertions: New content added to the document +- Deletions: Content removed from the document +- Formatting changes: Changes to text styling or formatting +- Moves: Content relocated within the document + +Each revision includes metadata such as: +- The author who made the change +- The type of change (insertion, deletion, etc.) +- The affected text content +- The revision's current status (accepted, rejected, or pending) + +## Step 1: Upload Your Document to Cloud Storage + +Before retrieving revisions, you need to upload a Word document with tracked changes to cloud storage. For this tutorial, we'll work with: +- source_with_revs.docx (a document with track changes enabled and several revisions) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Get the List of Revisions + +Now, let's retrieve all revisions from the document: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/revisions" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FilePath': 'source_files/word/source_with_revs.docx' + }" +``` + +The API will return a JSON array containing all revisions in the document. Here's a sample response: + +```json +[ + { + "id": 0, + "action": "None", + "text": "\rsssssssss", + "author": "GroupDocs", + "type": "Insertion" + }, + { + "id": 1, + "action": "None", + "text": "Many students, scholars and members of the \u0013 HYPERLINK \"https://en.wikipedia.org/wiki/Minister_(Christianity)\" \\o \"Minister (Christianity)\" \u0014Christian clergy\u0015 speak Latin fluently, and it is taught in primary, secondary and post-secondary educational institutions around the world.\u0013 HYPERLINK \"https://en.wikipedia.org/wiki/Latin\" \\l \"cite_note-4\" \u0014[4]\u0015\u0013 HYPERLINK \"https://en.wikipedia.org/wiki/Latin\" \\l \"cite_note-5\" \u0014[5]\u0015\r", + "author": "GroupDocs", + "type": "Deletion" + } +] +``` + +Each revision in the response includes: +- id: A unique identifier for the revision +- action: The current status of the revision (None, Accept, Reject) +- text: The text content affected by the revision +- author: The person who made the revision +- type: The type of revision (Insertion, Deletion, etc.) + +## Step 4: Process the Revision Information + +Once you have the revision information, you can process it according to your application's needs. Common use cases include: + +1. Building a revision history view: Display all revisions with author information and timestamps +2. Implementing a review workflow: Allow users to approve or reject revisions +3. Generating revision statistics: Count revisions by author, type, or other criteria +4. Creating differential reports: Analyze the nature and extent of changes made to the document + +## Try It Yourself + +Now it's your turn to implement revision retrieval in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new ReviewApi(configuration); + +var sourceFile = new FileInfo +{ + FilePath = "source_files/word/source_with_revs.docx" +}; + +var request = new GetRevisionsRequest(sourceFile); + +var revisions = apiInstance.GetRevisions(request); +Console.WriteLine("GetListOfRevisions: Revisions count: " + revisions.Count); + +// Process the revisions +foreach (var revision in revisions) +{ + Console.WriteLine($"Revision ID: {revision.Id}"); + Console.WriteLine($"Type: {revision.Type}"); + Console.WriteLine($"Author: {revision.Author}"); + Console.WriteLine($"Text: {revision.Text.Substring(0, Math.Min(50, revision.Text.Length))}..."); + Console.WriteLine("---------------------"); +} +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source_with_revs.docx" + +revisions = api_instance.get_revisions(groupdocs_comparison_cloud.GetRevisionsRequest(source)) + +print(f"Revisions count: {len(revisions)}") + +# Process the revisions +for revision in revisions: + print(f"Revision ID: {revision.id}") + print(f"Type: {revision.type}") + print(f"Author: {revision.author}") + # Show a preview of the text (up to 50 characters) + text_preview = revision.text[:50] + "..." if len(revision.text) > 50 else revision.text + print(f"Text: {text_preview}") + print("---------------------") +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.reviewApi = comparison_cloud.ReviewApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source_with_revs.docx"; + + let request = new comparison_cloud.GetRevisionsRequest(source); + let revisions = await reviewApi.getRevisions(request); + + console.log("Revisions count: " + revisions.length); + + // Process the revisions + for (let i = 0; i < revisions.length; i++) { + const revision = revisions[i]; + console.log("Revision ID: " + revision.id); + console.log("Type: " + revision.type); + console.log("Author: " + revision.author); + // Show a preview of the text (up to 50 characters) + const textPreview = revision.text.length > 50 ? + revision.text.substring(0, 50) + "..." : + revision.text; + console.log("Text: " + textPreview); + console.log("---------------------"); + } +} catch (error) { + console.log(error.message); +} +``` + +## Common Issues and Troubleshooting + +1. No Revisions Found: If the API returns an empty array, verify that your document actually contains tracked changes. To test, open the document in Microsoft Word and check if the "Review" tab shows any revisions. + +2. Character Encoding: The revision text may contain special characters or control codes used by Word's track changes feature. Handle these appropriately in your application. + +3. Large Documents: For documents with a large number of revisions, consider implementing pagination or lazy loading in your UI to improve performance. + +4. Unsupported Document Format: The revisions feature is primarily designed for Word documents (.docx, .doc). Other formats may not support revision tracking or may have limited support. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What API endpoint is used to retrieve revisions from a document? +2. What information is included in each revision object? +3. What is the difference between a revision and a change in GroupDocs.Comparison Cloud? +4. What are some common use cases for processing revision information? + +## What You've Learned + +In this tutorial, you've learned how to: +- Retrieve the complete list of revisions from Word documents +- Access detailed information about each revision, including author, type, and content +- Process revision information programmatically for various use cases + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a function that filters revisions by author or type +2. Build a simple UI that displays revisions in a readable format +3. Implement statistics to show the number of revisions by author or type +4. Create a workflow that allows users to batch accept or reject revisions + +## Next Steps + +Now that you've learned to retrieve document revisions, check out these related tutorials: +- [Tutorial: How to Accept or Reject Revisions](/advanced-features/accept-reject-revisions/) +- [Tutorial: How to Accept All Revisions](/advanced-features/accept-all-revisions/) +- [Tutorial: How to Reject All Revisions](/advanced-features/reject-all-revisions/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/advanced-features/reject-all-revisions/_index.md b/content/comparison/english/advanced-features/reject-all-revisions/_index.md new file mode 100644 index 0000000..fdb1592 --- /dev/null +++ b/content/comparison/english/advanced-features/reject-all-revisions/_index.md @@ -0,0 +1,260 @@ +--- +title: How to Reject All Revisions Tutorial +description: Learn to efficiently reject all document revisions at once using GroupDocs.Comparison Cloud API in this comprehensive step-by-step tutorial +weight: 120 +url: /advanced-features/reject-all-revisions/ +--- + +# Tutorial: How to Reject All Revisions + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Quickly reject all revisions in a Word document with a single API call +- Understand when and why you might need to reject all tracked changes +- Implement efficient document revision management workflows + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Word documents with tracked changes (revisions) ready in your cloud storage + +## The Practical Scenario + +Consider a scenario where your legal team receives a contract draft with numerous suggested changes tracked through Microsoft Word's "Track Changes" feature. After careful review, you determine that the suggested revisions undermine the contract's intent and need to be discarded entirely. Rather than rejecting each revision individually, you need an efficient way to reject all revisions at once and revert to the original document content. + +With GroupDocs.Comparison Cloud API, you can reject all revisions with a single API call, streamlining your document revision management process. + +## Understanding Batch Revision Rejection + +Similar to the [Accept All Revisions](/advanced-features/accept-all-revisions/) functionality, the GroupDocs.Comparison Cloud API provides a dedicated option for rejecting all revisions at once. Instead of retrieving all revisions and marking each one for rejection, you can set the `RejectAll` parameter to `true` in a single API call. + +This approach is particularly useful when: +- You need to revert a document to its original state before revisions +- Multiple suggested changes are not approved +- You want to preserve the original document content while still maintaining a record of rejected suggestions + +## Step 1: Upload Your Document to Cloud Storage + +Before processing revisions, you need to upload a Word document with tracked changes to cloud storage. For this tutorial, we'll work with: +- source_with_revs.docx (a document with track changes enabled and several revisions) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Reject All Revisions + +Now, let's reject all revisions in the document with a single API call: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/revisions" \ +-X PUT \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source_with_revs.docx' + }, + 'RejectAll': true, + 'OutputPath': 'output/result.docx' +}" +``` + +Notice that we set `RejectAll` to `true`. This tells the API to reject all revisions in the document automatically. + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Review the Result + +Use the link from the response to download the resulting document. This file contains the original document content with all revisions rejected. The tracked changes have been discarded, reverting the document to its state before those changes were suggested. + +## Try It Yourself + +Now it's your turn to implement batch revision rejection in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new ReviewApi(configuration); + +var options = new ApplyRevisionsOptions +{ + SourceFile = new FileInfo {FilePath = "source_files/word/source_with_revs.docx" }, + RejectAll = true, + OutputPath = "output/result.docx" +}; + +var response = apiInstance.ApplyRevisions(new ApplyRevisionsRequest(options)); + +Console.WriteLine("ApplyRevisions: Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +ReviewApi apiInstance = new ReviewApi(configuration); + +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source_with_revs.docx"); + +ApplyRevisionsOptions options = new ApplyRevisionsOptions(); +options.setSourceFile(sourceFileInfo); +options.setRejectAll(true); +options.setOutputPath("output/result.docx"); + +Link response = apiInstance.applyRevisions(new ApplyRevisionsRequest(options)); + +System.out.println("Output file link: " + response.getHref()); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source_with_revs.docx" +options = groupdocs_comparison_cloud.ApplyRevisionsOptions() +options.source_file = source +options.reject_all = True +options.output_path = "output/result.docx" + +response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options)) + +print("Output file link: " + response.href) +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.reviewApi = comparison_cloud.ReviewApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source_with_revs.docx"; + + let options = new comparison_cloud.ApplyRevisionsOptions(); + options.sourceFile = source; + options.rejectAll = true; + options.outputPath = "output/result.docx"; + + let response = await reviewApi.applyRevisions(new comparison_cloud.ApplyRevisionsRequest(options)); + console.log("Output file link: " + response.href); +} catch (error) { + console.log(error.message); +} +``` + +## When to Use Batch Rejection vs. Selective Processing + +Understanding when to use batch rejection versus selective processing is important for efficient document workflows: + +Use Batch Rejection (RejectAll) when: +- You need to revert a document to its original state +- All suggested changes have been reviewed and deemed unsuitable +- You want to preserve the base document while starting fresh with a new round of revisions +- You're implementing a workflow where certain types of changes are automatically rejected + +Use Selective Processing when: +- Some changes are valuable and should be kept +- Different revisions have different levels of approval +- You need to maintain a record of which specific revisions were rejected and why +- You're implementing a complex approval workflow with conditional logic + +## Common Issues and Troubleshooting + +1. Document Format Limitations: This feature is primarily designed for Word documents (.docx, .doc). Other formats may not support revision tracking or may have limited support. + +2. No Revisions Found: If the document doesn't contain any tracked changes, the API will still execute successfully, but no changes will occur in the document. + +3. Performance Considerations: For documents with a very large number of revisions, batch rejection is significantly more efficient than processing each revision individually. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What parameter do you set to reject all revisions in a document? +2. How does rejecting all revisions affect the document content? +3. In what scenarios would batch rejection be more appropriate than selective processing? +4. Does batch rejection modify the original document or create a new one? + +## What You've Learned + +In this tutorial, you've learned how to: +- Quickly reject all revisions in a Word document with a single API call +- Understand when and why you might need to reject all tracked changes +- Implement efficient document revision management workflows + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a document processing pipeline that automatically rejects all revisions from certain authors +2. Implement a hybrid approach that automatically rejects certain types of revisions but requires manual review for others +3. Build a simple command-line utility that rejects all revisions in multiple documents at once + +## Next Steps + +Now that you've learned to reject all revisions at once, check out these related tutorials: +- [Tutorial: How to Accept All Revisions](/advanced-features/accept-all-revisions/) +- [Tutorial: How to Accept or Reject Revisions](/advanced-features/accept-reject-revisions/) +- [Tutorial: How to Get List of Revisions](/advanced-features/get-list-of-revisions/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/advanced-features/set-password-for-resultant-document/_index.md b/content/comparison/english/advanced-features/set-password-for-resultant-document/_index.md new file mode 100644 index 0000000..4f58234 --- /dev/null +++ b/content/comparison/english/advanced-features/set-password-for-resultant-document/_index.md @@ -0,0 +1,328 @@ +--- +title: How to Set Password for Result Document Tutorial +description: Learn to secure comparison results with password protection using GroupDocs.Comparison Cloud API in this comprehensive step-by-step tutorial +weight: 130 +url: /advanced-features/set-password-for-resultant-document/ +--- + +# Tutorial: How to Set Password for Result Document + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Secure the output of document comparisons with password protection +- Configure password protection settings for result documents +- Implement secure document comparison workflows + +## Prerequisites + +Before starting this tutorial, you should have: +1. A GroupDocs.Comparison Cloud subscription or [free trial](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST API concepts +4. Familiarity with your preferred programming language (C#, Java, PHP, Node.js, Python, or Ruby) +5. Source and target documents ready for comparison in your cloud storage + +## The Practical Scenario + +Imagine you're comparing confidential contract documents for a merger and acquisition deal. The comparison results will highlight sensitive changes between contract versions, and this information needs to be secured before sharing with authorized stakeholders. By adding password protection to the result document, you ensure that only authorized individuals can access the comparison results. + +With GroupDocs.Comparison Cloud API, you can easily add password protection to the output document as part of your comparison workflow, enhancing document security and confidentiality. + +## Understanding Password Protection Options + +When using GroupDocs.Comparison Cloud to compare documents, you can specify password protection for the result document using the following settings: + +- PasswordSaveOption: Determines how to handle password protection. Values include: + - None: No password protection (default) + - User: Apply a user-defined password + - Source: Use the same password as the source document + - Target: Use the same password as the target document + +- Password: The actual password string to apply when PasswordSaveOption is set to "User" + +## Step 1: Upload Your Documents to Cloud Storage + +Before comparing documents, you need to upload them to cloud storage. For this tutorial, we'll work with: +- source.docx (original document) +- target.docx (modified document) + +Refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/) for detailed instructions on uploading files. + +## Step 2: Obtain Authorization Token + +To authorize API requests, you need to obtain a JWT (JSON Web Token) first: + +```bash +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" +``` + +The API will return a token in the response. Save this token for use in subsequent API calls. + +## Step 3: Compare Documents with Password Protection + +Now, let's compare the documents and set a password for the result document: + +```bash +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'OutputPath': 'output/result.docx', + 'Settings': { + 'PasswordSaveOption': 'User', + 'Password': '3333' + } +}" +``` + +In this example, we've set: +- `PasswordSaveOption` to `User` - indicating we want to use a custom password +- `Password` to `3333` - our chosen password for the result document + +Upon successful execution, the API will return a link to the resulting document: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Download and Verify the Result + +Use the link from the response to download the resulting document. When you try to open this document in a word processor like Microsoft Word, you'll be prompted to enter the password (`3333` in our example). This confirms that the password protection has been successfully applied. + +## Try It Yourself + +Now it's your turn to implement password protection for comparison results in your preferred programming language. Below are examples in various languages to help you get started. + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet-samples +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); + +var apiInstance = new CompareApi(configuration); +var options = new ComparisonOptions +{ + SourceFile = new FileInfo + { + FilePath = "source_files/word/source.docx" + }, + TargetFiles = new List { + new FileInfo { + FilePath = "target_files/word/target.docx" + } + }, + Settings = new Settings { + PasswordSaveOption = Settings.PasswordSaveOptionEnum.User, + Password = "3333" + }, + OutputPath = "output/result.docx" +}; + +var request = new ComparisonsRequest(options); +var response = apiInstance.Comparisons(request); + +Console.WriteLine("Output file link: " + response.Href); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); + +CompareApi apiInstance = new CompareApi(configuration); +FileInfo sourceFileInfo = new FileInfo(); +sourceFileInfo.setFilePath("source_files/word/source.docx"); +FileInfo targetFileInfo = new FileInfo(); +targetFileInfo.setFilePath("target_files/word/target.docx"); + +Settings settings = new Settings(); +settings.setPasswordSaveOption(Settings.PasswordSaveOptionEnum.USER); +settings.setPassword("3333"); + +ComparisonOptions options = new ComparisonOptions(); +options.setSourceFile(sourceFileInfo); +options.addTargetFilesItem(targetFileInfo); +options.setSettings(settings); +options.setOutputPath("output/result.docx"); + +ComparisonsRequest request = new ComparisonsRequest(options); +Link response = apiInstance.comparisons(request); + +System.out.println("Output file link: " + response.getHref()); +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-python-samples +import groupdocs_comparison_cloud + +client_id = "YOUR_CLIENT_ID" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys(client_id, client_secret) + +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/word/source.docx" +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/word/target.docx" +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target] +options.output_path = "output/result.docx" +settings = groupdocs_comparison_cloud.Settings() +settings.password_save_option = "User" +settings.password = "3333" +options.settings = settings + +request = groupdocs_comparison_cloud.ComparisonsRequest(options) +response = api_instance.comparisons(request) + +print("Output file link: " + response.href) +``` + +### Node.js Example + +```javascript +// For complete examples and data files, please go to https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-node-samples +global.comparison_cloud = require("groupdocs-comparison-cloud"); + +global.clientId = "YOUR_CLIENT_ID"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud +global.clientSecret = "YOUR_CLIENT_SECRET"; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud + +global.compareApi = comparison_cloud.CompareApi.fromKeys(clientId, clientSecret); + +try { + let source = new comparison_cloud.FileInfo(); + source.filePath = "source_files/word/source.docx"; + let target = new comparison_cloud.FileInfo(); + target.filePath = "target_files/word/target.docx"; + let settings = new comparison_cloud.Settings(); + settings.password = "3333"; + settings.passwordSaveOption = comparison_cloud.Settings.PasswordSaveOptionEnum.User; + let options = new comparison_cloud.ComparisonOptions(); + options.sourceFile = source; + options.targetFiles = [target]; + options.outputPath = "output/result.docx"; + options.settings = settings; + + let request = new comparison_cloud.ComparisonsRequest(options); + + let response = await compareApi.comparisons(request); + console.log("Output file link: " + response.href); +} catch (error) { + console.log(error.message); +} +``` + +## Exploring Other Password Protection Options + +Besides setting a custom user password, you can also choose to inherit the password from either the source or target document: + +### Using Source Document's Password + +```csharp +Settings = new Settings { + PasswordSaveOption = Settings.PasswordSaveOptionEnum.Source +} +``` + +This is useful when you want to maintain the same security level as the original document. + +### Using Target Document's Password + +```csharp +Settings = new Settings { + PasswordSaveOption = Settings.PasswordSaveOptionEnum.Target +} +``` + +This can be appropriate when the target document represents a newer version with updated security requirements. + +## Implementing Secure Document Workflows + +Password protection is just one aspect of secure document workflows. Consider these additional best practices: + +1. Use Strong Passwords: Choose complex passwords that are difficult to guess. + +2. Secure Password Transmission: Avoid hardcoding passwords in your application code. Instead, use secure methods to transmit passwords, such as environment variables or secure key management services. + +3. Temporary Result Files: Configure your workflow to delete result files from cloud storage after they've been downloaded and securely stored in your system. + +4. Access Control: Implement proper access controls in your application to ensure only authorized users can initiate document comparisons and access results. + +## Common Issues and Troubleshooting + +1. Format Compatibility: Not all document formats support password protection. This feature works primarily with Word documents (.docx, .doc), Excel spreadsheets (.xlsx, .xls), and PowerPoint presentations (.pptx, .ppt). + +2. Password Recovery: If the password is lost, there is no built-in recovery method. Ensure passwords are securely stored and accessible when needed. + +3. API Parameter Validation: The API performs validation on the `PasswordSaveOption` parameter. If an invalid value is provided, an error will be returned. + +## Learning Checkpoint + +Let's verify your understanding with a quick check: +1. What are the available options for `PasswordSaveOption`? +2. When would you use `PasswordSaveOption.Source` instead of `PasswordSaveOption.User`? +3. What document formats typically support password protection? +4. How would you implement a workflow where different comparison results require different password strengths? + +## What You've Learned + +In this tutorial, you've learned how to: +- Secure the output of document comparisons with password protection +- Configure different password protection settings for result documents +- Implement secure document comparison workflows +- Choose the appropriate password source based on your security requirements + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a function that generates strong random passwords for comparison results +2. Implement a workflow that uses different password sources based on document type +3. Build a system that securely stores and manages passwords for comparison results +4. Create a batch comparison process that applies password protection to multiple comparison results + +## Next Steps + +Now that you've learned to secure comparison results with passwords, check out these related tutorials: +- [Tutorial: How to Compare Password-Protected Documents](/advanced-features/compare-password-protected/) +- [Tutorial: How to Compare Multiple Documents](/advanced-features/compare-multiple-documents/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/getting-started/_index.md b/content/comparison/english/getting-started/_index.md new file mode 100644 index 0000000..7496fc1 --- /dev/null +++ b/content/comparison/english/getting-started/_index.md @@ -0,0 +1,40 @@ +--- +title: GroupDocs.Comparison Cloud API Document Getting Started Tutorials +weight: 1 +description: Step-by-step tutorials for developers to learn how to use GroupDocs.Comparison Cloud API to compare various document formats +url: /getting-started/ +--- + +# GroupDocs.Comparison Cloud API Document Getting Started Tutorials + +Welcome to our hands-on tutorial series for developers looking to master document comparison with GroupDocs.Comparison Cloud API. These step-by-step guides will take you from basic to advanced concepts, ensuring you gain practical experience with real-world implementation scenarios. + +## Learning Path + +This tutorial series is designed as a progressive learning path. We recommend following the tutorials in sequence to build a solid foundation before moving to more complex topics: + +1. [Tutorial: How to Get Supported File Formats](/getting-started/get-supported-file-formats/) - Learn how to retrieve all file formats supported by the API for comparison +2. [Tutorial: How to Get Document Information](/getting-started/get-document-information/) - Learn to extract essential information from documents before comparison +3. [Tutorial: How to Compare Documents](/getting-started/compare-documents/) - Master the core document comparison functionality +4. [Tutorial: How to Compare PDF Files](/getting-started/compare-pdf-files/) - Explore PDF-specific comparison capabilities +5. [Tutorial: How to Create Document Previews](/getting-started/create-document-preview/) - Learn to generate visual previews of documents + +Each tutorial includes complete code examples, practical scenarios, and detailed explanations to help you implement document comparison features in your applications. + +## Prerequisites + +Before starting these tutorials, you should: + +- Have a [GroupDocs.Comparison Cloud account](https://dashboard.groupdocs.cloud/#/apps) +- Be familiar with RESTful API concepts +- Have basic knowledge of your preferred programming language (C#, Java, PHP, Python, Ruby, or Node.js) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [Live Demo](https://products.groupdocs.app/comparison/family) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.comparison-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/getting-started/compare-documents/_index.md b/content/comparison/english/getting-started/compare-documents/_index.md new file mode 100644 index 0000000..ea9b1e4 --- /dev/null +++ b/content/comparison/english/getting-started/compare-documents/_index.md @@ -0,0 +1,370 @@ +--- +title: How to Compare Documents with GroupDocs.Comparison Cloud Tutorial +weight: 3 +description: Learn how to compare documents and identify changes between versions using GroupDocs.Comparison Cloud API in this comprehensive tutorial +url: /getting-started/compare-documents/ +--- + +# Tutorial: How to Compare Documents with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Compare two documents and identify differences between them +- Understand the change detection capabilities of GroupDocs.Comparison Cloud +- Implement document comparison in different programming languages +- Interpret and work with comparison results + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret credentials +- Source and target documents uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding Document Comparison + +GroupDocs.Comparison Cloud API provides powerful document comparison capabilities that can detect changes in different document parts including: + +- Text blocks (paragraphs, words, and characters) +- Tables +- Images +- Shapes and other elements + +Changes are highlighted with different colors in the resulting document: +- Added content - blue +- Modified content - green +- Style changes - green +- Deleted content - red + +## Step 1: Upload Documents (If Needed) + +Before comparing documents, make sure you have uploaded both source and target documents to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To compare documents, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`POST https://api.groupdocs.cloud/v2.0/comparison/comparisons` + +This endpoint requires a JSON body with the source and target file paths, as well as the output path for the comparison result. + +## Step 3: Implementing with cURL + +Let's start with a cURL example to understand the request and response format: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to compare documents +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/word/source.docx' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/word/target.docx' + } + ], + 'OutputPath': 'output/result.docx' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will provide information about the comparison result file: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx", + "rel": "output/result.docx", + "type": "file", + "title": "result.docx" +} +``` + +## Step 4: Implementing with SDKs + +Now let's implement the same functionality using various SDKs. + +### C# Example + +```csharp +using System; +using System.Collections.Generic; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace CompareDocumentsExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create CompareApi instance + var compareApi = new CompareApi(configuration); + + // Prepare comparison options + var options = new ComparisonOptions + { + SourceFile = new FileInfo { FilePath = "source_files/word/source.docx" }, + TargetFiles = new List { new FileInfo { FilePath = "target_files/word/target.docx" } }, + OutputPath = "output/result.docx" + }; + + // Create comparison request + var request = new ComparisonsRequest(options); + + try + { + // Execute comparison + var response = compareApi.Comparisons(request); + + // Display result information + Console.WriteLine($"Comparison completed successfully!"); + Console.WriteLine($"Result file URL: {response.Href}"); + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import ComparisonOptions, FileInfo + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create CompareApi instance +compare_api = groupdocs_comparison_cloud.CompareApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare comparison options +source_file = FileInfo() +source_file.file_path = "source_files/word/source.docx" + +target_file = FileInfo() +target_file.file_path = "target_files/word/target.docx" + +options = ComparisonOptions() +options.source_file = source_file +options.target_files = [target_file] +options.output_path = "output/result.docx" + +# Create comparison request +request = groupdocs_comparison_cloud.ComparisonsRequest(options) + +try: + # Execute comparison + response = compare_api.comparisons(request) + + # Display result information + print("Comparison completed successfully!") + print(f"Result file URL: {response.href}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.CompareApi; +import com.groupdocs.cloud.comparison.model.requests.ComparisonsRequest; +import java.util.Collections; + +public class CompareDocumentsExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create CompareApi instance + CompareApi compareApi = new CompareApi(configuration); + + // Prepare comparison options + FileInfo sourceFileInfo = new FileInfo(); + sourceFileInfo.setFilePath("source_files/word/source.docx"); + + FileInfo targetFileInfo = new FileInfo(); + targetFileInfo.setFilePath("target_files/word/target.docx"); + + ComparisonOptions options = new ComparisonOptions(); + options.setSourceFile(sourceFileInfo); + options.setTargetFiles(Collections.singletonList(targetFileInfo)); + options.setOutputPath("output/result.docx"); + + // Create comparison request + ComparisonsRequest request = new ComparisonsRequest(options); + + try { + // Execute comparison + Link response = compareApi.comparisons(request); + + // Display result information + System.out.println("Comparison completed successfully!"); + System.out.println("Result file URL: " + response.getHref()); + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create CompareApi instance +const compareApi = comparison.CompareApi.fromKeys(clientId, clientSecret); + +// Prepare comparison options +const sourceFile = new comparison.FileInfo(); +sourceFile.filePath = "source_files/word/source.docx"; + +const targetFile = new comparison.FileInfo(); +targetFile.filePath = "target_files/word/target.docx"; + +const options = new comparison.ComparisonOptions(); +options.sourceFile = sourceFile; +options.targetFiles = [targetFile]; +options.outputPath = "output/result.docx"; + +// Create comparison request +const request = new comparison.ComparisonsRequest(options); + +// Execute comparison +compareApi.comparisons(request) + .then(response => { + console.log("Comparison completed successfully!"); + console.log(`Result file URL: ${response.href}`); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: Customizing Comparison Options + +GroupDocs.Comparison Cloud allows customizing the comparison process with additional options: + +```csharp +// Additional comparison options +options.CompareOptions = new CompareOptions +{ + // Show deleted content + ShowDeletedContent = true, + // Show inserted content + ShowInsertedContent = true, + // Show styled content + ShowStyleChangedContent = true, + // Set sensitivity level (higher means more changes detected) + SensitivityOfComparison = 75, + // Set comparison style colors + DeletedItemsStyle = new StyleSettings { HighlightColor = "Red" }, + InsertedItemsStyle = new StyleSettings { HighlightColor = "Blue" }, + ChangedItemsStyle = new StyleSettings { HighlightColor = "Green" }, + // Process headers and footers + HeaderFootersComparison = true +}; +``` + +## Step 6: Understanding the Comparison Results + +After successful comparison, the API returns a link to the result document. This document contains visual highlights of all changes detected between the source and target documents. + +For a detailed analysis, you can: + +1. Download the result document using the provided link +2. Open the document to view highlighted changes +3. Use the color coding to identify the types of changes: + - Blue highlights indicate added content + - Green highlights indicate modified content + - Red highlights indicate deleted content + +## Try It Yourself + +Now it's your turn to practice: + +1. Upload two slightly different versions of a document to your cloud storage +2. Use the code examples to compare these documents +3. Download and examine the comparison result +4. Experiment with different comparison options to see how they affect the results +5. Try comparing different document formats (PDF, Word, Excel, etc.) + +## Practical Use Cases + +Document comparison has many practical applications: + +1. Contract Review: Identify changes between contract versions +2. Document Collaboration: Track changes made by different contributors +3. Quality Assurance: Verify document updates meet requirements +4. Compliance: Ensure document modifications comply with regulations +5. Version Control: Maintain a history of document changes + +## Troubleshooting Tips + +- File Not Found: Ensure both source and target files exist at the specified paths +- Unsupported Format: Verify both documents are in supported formats +- Empty Result: Check that the documents actually contain differences +- Authorization Issues: Confirm your Client ID and Client Secret are correct +- Result File Issues: Ensure the output path is valid and you have write permissions + +## What You've Learned + +In this tutorial, you've learned: +- How to compare two documents and identify differences between them +- How to customize the comparison process for specific needs +- How to implement document comparison in different programming languages +- How to interpret and work with comparison results +- Practical applications for document comparison + +## Next Steps + +Now that you can perform basic document comparisons, you can explore more specific comparison scenarios: +- [Tutorial: How to Compare PDF Files](/getting-started/compare-pdf-files/) + +You can also learn how to generate previews of your documents: +- [Tutorial: How to Create Document Previews](/getting-started/create-document-preview/) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/getting-started/compare-pdf-files/_index.md b/content/comparison/english/getting-started/compare-pdf-files/_index.md new file mode 100644 index 0000000..ca99ac6 --- /dev/null +++ b/content/comparison/english/getting-started/compare-pdf-files/_index.md @@ -0,0 +1,372 @@ +--- +id: "how-to-compare-pdf-files-tutorial" +url: /getting-started/how-to-compare-pdf-files" +title: "Tutorial: How to Compare PDF Files with GroupDocs.Comparison Cloud" +productName: "GroupDocs.Comparison Cloud" +weight: 4 +description: "Learn how to compare PDF documents and detect changes between versions using GroupDocs.Comparison Cloud API in this step-by-step tutorial" +keywords: "pdf comparison tutorial, compare pdf files api, detect pdf changes, groupdocs cloud api tutorial" +toc: True +--- + +# Tutorial: How to Compare PDF Files with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Compare two PDF documents to identify differences +- Work with PDF-specific comparison features +- Implement PDF comparison in different programming languages +- Interpret and handle comparison results for PDF files + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret credentials +- Source and target PDF files uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding PDF Comparison + +PDF comparison is one of the most common document comparison scenarios. GroupDocs.Comparison Cloud API provides specialized functionality for comparing PDF documents, detecting changes in: + +- Text content +- Images and graphics +- Form fields +- Annotations +- Document formatting and layout + +Let's learn how to implement PDF comparison with GroupDocs.Comparison Cloud. + +## Step 1: Upload PDF Documents (If Needed) + +Before comparing PDF files, make sure you have uploaded both source and target PDFs to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To compare PDF documents, we'll use the same GroupDocs.Comparison Cloud REST API resource as for other file types: + +`POST https://api.groupdocs.cloud/v2.0/comparison/comparisons` + +This endpoint requires a JSON body with the source and target file paths, as well as the output path for the comparison result. + +## Step 3: Implementing with cURL + +Let's start with a cURL example specifically for PDF comparison: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to compare PDF documents +curl -v "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'SourceFile': { + 'FilePath': 'source_files/pdf/source.pdf' + }, + 'TargetFiles': [ + { + 'FilePath': 'target_files/pdf/target.pdf' + } + ], + 'OutputPath': 'output/result.pdf' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will provide information about the comparison result file: + +```json +{ + "href": "https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.pdf", + "rel": "output/result.pdf", + "type": "file", + "title": "result.pdf" +} +``` + +## Step 4: Implementing with SDKs + +Now let's implement PDF comparison using various SDKs. + +### C# Example + +```csharp +using System; +using System.Collections.Generic; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace ComparePdfExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create CompareApi instance + var apiInstance = new CompareApi(configuration); + + // Prepare comparison options + var options = new ComparisonOptions + { + SourceFile = new FileInfo { FilePath = "source_files/pdf/source.pdf" }, + TargetFiles = new List { new FileInfo { FilePath = "target_files/pdf/target.pdf" } }, + OutputPath = "output/result.pdf" + }; + + // Create comparison request + var request = new ComparisonsRequest(options); + + try + { + // Execute comparison + var response = apiInstance.Comparisons(request); + + // Display result information + Console.WriteLine("PDF comparison completed successfully!"); + Console.WriteLine($"Result file URL: {response.Href}"); + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import ComparisonOptions, FileInfo + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create CompareApi instance +api_instance = groupdocs_comparison_cloud.CompareApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare comparison options +source = groupdocs_comparison_cloud.FileInfo() +source.file_path = "source_files/pdf/source.pdf" + +target = groupdocs_comparison_cloud.FileInfo() +target.file_path = "target_files/pdf/target.pdf" + +options = groupdocs_comparison_cloud.ComparisonOptions() +options.source_file = source +options.target_files = [target] +options.output_path = "output/result.pdf" + +# Create comparison request +request = groupdocs_comparison_cloud.ComparisonsRequest(options) + +try: + # Execute comparison + response = api_instance.comparisons(request) + + # Display result information + print("PDF comparison completed successfully!") + print(f"Result file URL: {response.href}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.CompareApi; +import com.groupdocs.cloud.comparison.model.requests.ComparisonsRequest; +import java.util.Collections; + +public class ComparePdfExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create CompareApi instance + CompareApi apiInstance = new CompareApi(configuration); + + // Prepare comparison options + FileInfo sourceFileInfo = new FileInfo(); + sourceFileInfo.setFilePath("source_files/pdf/source.pdf"); + + FileInfo targetFileInfo = new FileInfo(); + targetFileInfo.setFilePath("target_files/pdf/target.pdf"); + + ComparisonOptions options = new ComparisonOptions(); + options.setSourceFile(sourceFileInfo); + options.setTargetFiles(Collections.singletonList(targetFileInfo)); + options.setOutputPath("output/result.pdf"); + + // Create comparison request + ComparisonsRequest request = new ComparisonsRequest(options); + + try { + // Execute comparison + Link response = apiInstance.comparisons(request); + + // Display result information + System.out.println("PDF comparison completed successfully!"); + System.out.println("Result file URL: " + response.getHref()); + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create CompareApi instance +const compareApi = comparison.CompareApi.fromKeys(clientId, clientSecret); + +// Prepare comparison options +const source = new comparison.FileInfo(); +source.filePath = "source_files/pdf/source.pdf"; + +const target = new comparison.FileInfo(); +target.filePath = "target_files/pdf/target.pdf"; + +const options = new comparison.ComparisonOptions(); +options.sourceFile = source; +options.targetFiles = [target]; +options.outputPath = "output/result.pdf"; + +// Create comparison request +const request = new comparison.ComparisonsRequest(options); + +// Execute comparison +compareApi.comparisons(request) + .then(response => { + console.log("PDF comparison completed successfully!"); + console.log(`Result file URL: ${response.href}`); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: PDF-Specific Comparison Options + +When comparing PDF documents, you can use additional options specific to PDF files: + +```csharp +// PDF-specific comparison options +options.CompareOptions = new CompareOptions +{ + // Compare bookmarks in PDFs + CompareBookmarks = true, + // Compare document metadata + CompareDocumentProperties = true, + // Compare backgrounds + CompareBackgrounds = true, + // Other generic options + ShowDeletedContent = true, + ShowInsertedContent = true, + // Highlight style for PDF changes + InsertedItemsStyle = new StyleSettings + { + HighlightColor = "Blue", + FontColor = "Black", + Bold = true + } +}; +``` + +## Step 6: Understanding PDF Comparison Results + +After successfully comparing PDF documents, you can: + +1. Download the result file using the provided URL +2. Open the PDF to view the highlighted changes +3. Navigate through the document to identify: + - Text changes (additions, deletions, modifications) + - Image differences + - Form field changes + - Formatting differences + +The comparison result is a standard PDF file that can be viewed in any PDF reader. + +## Try It Yourself + +Now it's your turn to practice: + +1. Upload two different versions of a PDF document to your cloud storage +2. Use the provided code examples to compare these PDF files +3. Download and examine the comparison result +4. Experiment with different comparison options specific to PDFs +5. Try comparing PDFs with different types of content (text, images, forms) + +## Practical Applications for PDF Comparison + +PDF comparison is particularly useful in several scenarios: + +1. Legal Document Review: Compare contract versions in PDF format +2. PDF Form Processing: Identify changes in completed PDF forms +3. PDF Report Analysis: Compare financial or technical reports +4. Academic Documentation: Review changes in research papers or academic PDFs +5. PDF Manual Updates: Verify changes between different versions of manuals or guides + +## Troubleshooting Tips + +- Large PDF Files: If comparing large PDFs, increase request timeout settings +- Complex PDF Structure: For PDFs with complex layouts, adjust sensitivity settings +- PDF Security: Ensure PDFs are not password-protected or have restrictions +- PDF Version Compatibility: For best results, compare PDFs of the same version +- Text Recognition Issues: For scanned PDFs, quality of comparison depends on text recognition + +## What You've Learned + +In this tutorial, you've learned: +- How to compare PDF documents using GroupDocs.Comparison Cloud API +- How to configure PDF-specific comparison options +- How to implement PDF comparison in different programming languages +- How to interpret and work with PDF comparison results +- Practical applications for PDF comparison + +## Next Steps + +Now that you can compare PDF files, you might want to learn how to create previews of documents: +- [Tutorial: How to Create Document Previews](/getting-started/create-document-preview) + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/getting-started/create-document-preview/_index.md b/content/comparison/english/getting-started/create-document-preview/_index.md new file mode 100644 index 0000000..5029d79 --- /dev/null +++ b/content/comparison/english/getting-started/create-document-preview/_index.md @@ -0,0 +1,400 @@ +--- +title: How to Create Document Previews with GroupDocs.Comparison Cloud Tutorial +weight: 5 +description: Learn how to generate visual previews of documents before and after comparison using GroupDocs.Comparison Cloud API in this step-by-step tutorial +url: /getting-started/create-document-preview/ +--- + +# Tutorial: How to Create Document Previews with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Generate visual previews of documents as images +- Customize preview options (size, format, quality) +- Implement document preview functionality in different programming languages +- Use previews effectively in document comparison workflows + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps) +- Your Client ID and Client Secret credentials +- Documents uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding Document Previews + +Document previews allow users to visualize documents without opening them in their native applications. In the context of document comparison, previews are particularly valuable for: + +- Quickly reviewing documents before comparison +- Displaying comparison results in web applications +- Creating thumbnails for document management interfaces +- Providing mobile-friendly document views + +GroupDocs.Comparison Cloud API enables generating high-quality previews of documents as images, with one image per page. + +## Step 1: Upload Documents (If Needed) + +Before generating previews, make sure you have uploaded the target document to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To create document previews, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`POST https://api.groupdocs.cloud/v2.0/comparison/preview` + +This endpoint requires a JSON body with the file information and preview options. + +## Step 3: Implementing with cURL + +Let's start with a cURL example to understand the request and response format: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to create document preview +curl -v "https://api.groupdocs.cloud/v2.0/comparison/preview" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'sample2.pdf' + }, + 'Format': 'jpeg', + 'OutputFolder': 'Output' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will provide information about the generated preview files: + +```json +[ + { + "href": "http://api.groupdocs.cloud/v2.0/comparison/storage/file/Output/sample2_1.jpeg", + "rel": "Output/sample2_1.jpeg", + "type": "file", + "title": "sample2_1.jpeg" + }, + { + "href": "http://api.groupdocs.cloud/v2.0/comparison/storage/file/Output/sample2_2.jpeg", + "rel": "Output/sample2_2.jpeg", + "type": "file", + "title": "sample2_2.jpeg" + } +] +``` + +## Step 4: Implementing with SDKs + +Now let's implement document preview functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace CreateDocumentPreviewExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create PreviewApi instance + var apiInstance = new PreviewApi(configuration); + + // Prepare preview options + var options = new PreviewOptions + { + FileInfo = new FileInfo { FilePath = "source_files/word/source.docx" }, + Format = PreviewOptions.FormatEnum.Png, + OutputFolder = "output" + }; + + // Create preview request + var request = new PreviewRequest(options); + + try + { + // Execute preview generation + var response = apiInstance.Preview(request); + + // Display result information + Console.WriteLine($"Preview generation completed successfully!"); + Console.WriteLine($"Generated {response.Count} preview images:"); + + foreach (var link in response) + { + Console.WriteLine($" - {link.Title}: {link.Href}"); + } + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import PreviewOptions, FileInfo + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create PreviewApi instance +preview_api = groupdocs_comparison_cloud.PreviewApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare preview options +file_info = FileInfo() +file_info.file_path = "source_files/word/source.docx" + +options = PreviewOptions() +options.file_info = file_info +options.format = "jpg" # Can be jpg, png, etc. +options.output_folder = "output" + +# Create preview request +request = groupdocs_comparison_cloud.PreviewRequest(options) + +try: + # Execute preview generation + response = preview_api.preview(request) + + # Display result information + print("Preview generation completed successfully!") + print(f"Generated {len(response)} preview images:") + + for link in response: + print(f" - {link.title}: {link.href}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.PreviewApi; +import com.groupdocs.cloud.comparison.model.requests.PreviewRequest; +import java.util.List; + +public class CreateDocumentPreviewExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create PreviewApi instance + PreviewApi apiInstance = new PreviewApi(configuration); + + // Prepare preview options + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("source_files/word/source.docx"); + + PreviewOptions options = new PreviewOptions(); + options.setFileInfo(fileInfo); + options.setFormat(FormatEnum.JPEG); + options.setOutputFolder("output"); + + // Create preview request + PreviewRequest request = new PreviewRequest(options); + + try { + // Execute preview generation + List response = apiInstance.preview(request); + + // Display result information + System.out.println("Preview generation completed successfully!"); + System.out.println("Generated " + response.size() + " preview images:"); + + for (Link link : response) { + System.out.println(" - " + link.getTitle() + ": " + link.getHref()); + } + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create PreviewApi instance +const previewApi = comparison.PreviewApi.fromKeys(clientId, clientSecret); + +// Prepare preview options +const fileInfo = new comparison.FileInfo(); +fileInfo.filePath = "source_files/word/source.docx"; + +const options = new comparison.PreviewOptions(); +options.fileInfo = fileInfo; +options.format = "png"; // Can be png, jpg, etc. +options.outputFolder = "output"; + +// Create preview request +const request = new comparison.PreviewRequest(options); + +// Execute preview generation +previewApi.preview(request) + .then(response => { + console.log("Preview generation completed successfully!"); + console.log(`Generated ${response.length} preview images:`); + + response.forEach(link => { + console.log(` - ${link.title}: ${link.href}`); + }); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: Customizing Preview Options + +GroupDocs.Comparison Cloud provides several options to customize document previews: + +1. Output Format: Choose between JPEG, PNG, and other image formats +2. Width and Height: Specify custom dimensions for preview images +3. Quality: Adjust image quality for JPEG format (affects file size) +4. Page Range: Generate previews for specific pages only + +Here's an example with additional options: + +```csharp +// Advanced preview options +var options = new PreviewOptions +{ + FileInfo = new FileInfo { FilePath = "source_files/word/source.docx" }, + Format = PreviewOptions.FormatEnum.Jpeg, + OutputFolder = "output", + Width = 800, // Set preview width + Height = 1000, // Set preview height + PageNumbers = new List { 1, 2, 3 }, // Generate previews for specific pages only + Resolution = 150 // DPI resolution +} +``` + +## Step 6: Working with Preview Images + +After generating preview images, you can: + +1. Download the Images: Use the URLs provided in the response to download the preview images +2. Display in Web Applications: Embed the images in web pages or document viewers +3. Create Thumbnails: Use smaller versions of the images as thumbnails in document lists +4. Combine with Comparison: Generate previews of both original and comparison result documents + +Here's a simple example of how to download the preview images using C#: + +```csharp +// Download preview images +using (var client = new WebClient()) +{ + foreach (var link in response) + { + // Extract file name from URL + string fileName = link.Title; + + // Download the file + client.DownloadFile(link.Href, Path.Combine("Downloads", fileName)); + Console.WriteLine($"Downloaded: {fileName}"); + } +} +``` + +## Step 7: Integrating Previews in Comparison Workflow + +Document previews can enhance your document comparison workflow in several ways: + +1. Pre-Comparison Verification: Show users previews of documents before comparison to confirm they're comparing the right files +2. Post-Comparison Review: Generate previews of the comparison result for quick visual assessment +3. Side-by-Side Viewing: Display previews of original and modified documents side by side +4. Mobile-Friendly Access: Provide lightweight image previews for mobile users + +## Try It Yourself + +Now it's your turn to practice: + +1. Upload a multi-page document to your cloud storage +2. Generate previews using the code examples +3. Download and view the preview images +4. Experiment with different preview formats and options +5. Create a simple web page to display the document previews + +## Practical Applications + +Document previews have numerous practical applications: + +1. Document Management Systems: Provide visual thumbnails of documents +2. Web-Based Document Viewers: Show document content without requiring native applications +3. Mobile Applications: Deliver lightweight document views on mobile devices +4. Email Attachments: Generate previews of email attachments +5. Content Approval Workflows: Allow quick visual review of documents before approval + +## Troubleshooting Tips + +- Empty Preview: Ensure the document is not corrupted and is in a supported format +- Low-Quality Images: Increase the resolution or use PNG format for better quality +- Memory Issues: For very large documents, generate previews page by page +- Font Problems: Some fonts may not render correctly in previews +- File Path Issues: Verify the document exists at the specified path in your storage + +## What You've Learned + +In this tutorial, you've learned: +- How to generate visual previews of documents as images +- How to customize preview options for different needs +- How to implement document preview functionality in different programming languages +- How to use previews effectively in document comparison workflows +- Practical applications for document previews + +## Next Steps + +Having completed all the tutorials in this series, you now have a solid foundation in using GroupDocs.Comparison Cloud API for document comparison tasks. To further enhance your skills, you might want to explore: + +- Advanced comparison options and settings +- Comparing specific document types (Excel, PowerPoint, etc.) +- Implementing document comparison in your applications +- Automating document comparison workflows + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/comparison/english/getting-started/create-document-preview/create-document-preview-tutorial.md b/content/comparison/english/getting-started/create-document-preview/create-document-preview-tutorial.md new file mode 100644 index 0000000..22805f6 --- /dev/null +++ b/content/comparison/english/getting-started/create-document-preview/create-document-preview-tutorial.md @@ -0,0 +1,313 @@ +--- +id: "create-document-preview-tutorial" +url: /getting-started/create-document-preview" +title: "Tutorial: How to Create Document Previews with GroupDocs.Comparison Cloud" +productName: "GroupDocs.Comparison Cloud" +weight: 5 +description: "Learn how to generate visual previews of documents before and after comparison using GroupDocs.Comparison Cloud API in this step-by-step tutorial" +keywords: "document preview tutorial, generate document images, preview comparison results, groupdocs cloud api tutorial" +toc: True +--- + +# Tutorial: How to Create Document Previews with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Generate visual previews of documents as images +- Customize preview options (size, format, quality) +- Implement document preview functionality in different programming languages +- Use previews effectively in document comparison workflows + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret credentials +- Documents uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding Document Previews + +Document previews allow users to visualize documents without opening them in their native applications. In the context of document comparison, previews are particularly valuable for: + +- Quickly reviewing documents before comparison +- Displaying comparison results in web applications +- Creating thumbnails for document management interfaces +- Providing mobile-friendly document views + +GroupDocs.Comparison Cloud API enables generating high-quality previews of documents as images, with one image per page. + +## Step 1: Upload Documents (If Needed) + +Before generating previews, make sure you have uploaded the target document to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To create document previews, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`POST https://api.groupdocs.cloud/v2.0/comparison/preview` + +This endpoint requires a JSON body with the file information and preview options. + +## Step 3: Implementing with cURL + +Let's start with a cURL example to understand the request and response format: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to create document preview +curl -v "https://api.groupdocs.cloud/v2.0/comparison/preview" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'sample2.pdf' + }, + 'Format': 'jpeg', + 'OutputFolder': 'Output' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will provide information about the generated preview files: + +```json +[ + { + "href": "http://api.groupdocs.cloud/v2.0/comparison/storage/file/Output/sample2_1.jpeg", + "rel": "Output/sample2_1.jpeg", + "type": "file", + "title": "sample2_1.jpeg" + }, + { + "href": "http://api.groupdocs.cloud/v2.0/comparison/storage/file/Output/sample2_2.jpeg", + "rel": "Output/sample2_2.jpeg", + "type": "file", + "title": "sample2_2.jpeg" + } +] +``` + +## Step 4: Implementing with SDKs + +Now let's implement document preview functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace CreateDocumentPreviewExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create PreviewApi instance + var apiInstance = new PreviewApi(configuration); + + // Prepare preview options + var options = new PreviewOptions + { + FileInfo = new FileInfo { FilePath = "source_files/word/source.docx" }, + Format = PreviewOptions.FormatEnum.Png, + OutputFolder = "output" + }; + + // Create preview request + var request = new PreviewRequest(options); + + try + { + // Execute preview generation + var response = apiInstance.Preview(request); + + // Display result information + Console.WriteLine($"Preview generation completed successfully!"); + Console.WriteLine($"Generated {response.Count} preview images:"); + + foreach (var link in response) + { + Console.WriteLine($" - {link.Title}: {link.Href}"); + } + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import PreviewOptions, FileInfo + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create PreviewApi instance +preview_api = groupdocs_comparison_cloud.PreviewApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare preview options +file_info = FileInfo() +file_info.file_path = "source_files/word/source.docx" + +options = PreviewOptions() +options.file_info = file_info +options.format = "jpg" # Can be jpg, png, etc. +options.output_folder = "output" + +# Create preview request +request = groupdocs_comparison_cloud.PreviewRequest(options) + +try: + # Execute preview generation + response = preview_api.preview(request) + + # Display result information + print("Preview generation completed successfully!") + print(f"Generated {len(response)} preview images:") + + for link in response: + print(f" - {link.title}: {link.href}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.PreviewApi; +import com.groupdocs.cloud.comparison.model.requests.PreviewRequest; +import java.util.List; + +public class CreateDocumentPreviewExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create PreviewApi instance + PreviewApi apiInstance = new PreviewApi(configuration); + + // Prepare preview options + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("source_files/word/source.docx"); + + PreviewOptions options = new PreviewOptions(); + options.setFileInfo(fileInfo); + options.setFormat(FormatEnum.JPEG); + options.setOutputFolder("output"); + + // Create preview request + PreviewRequest request = new PreviewRequest(options); + + try { + // Execute preview generation + List response = apiInstance.preview(request); + + // Display result information + System.out.println("Preview generation completed successfully!"); + System.out.println("Generated " + response.size() + " preview images:"); + + for (Link link : response) { + System.out.println(" - " + link.getTitle() + ": " + link.getHref()); + } + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create PreviewApi instance +const previewApi = comparison.PreviewApi.fromKeys(clientId, clientSecret); + +// Prepare preview options +const fileInfo = new comparison.FileInfo(); +fileInfo.filePath = "source_files/word/source.docx"; + +const options = new comparison.PreviewOptions(); +options.fileInfo = fileInfo; +options.format = "png"; // Can be png, jpg, etc. +options.outputFolder = "output"; + +// Create preview request +const request = new comparison.PreviewRequest(options); + +// Execute preview generation +previewApi.preview(request) + .then(response => { + console.log("Preview generation completed successfully!"); + console.log(`Generated ${response.length} preview images:`); + + response.forEach(link => { + console.log(` - ${link.title}: ${link.href}`); + }); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: Customizing Preview Options + +GroupDocs.Comparison Cloud provides several options to customize document previews: + +1. Output Format: Choose between JPEG, PNG, and other image formats +2. Width and Height: Specify custom dimensions for preview images +3. Quality: Adjust image quality for JPEG format (affects file size) +4. Page Range: Generate previews for specific pages only + +Here's an example with additional options: + +```csharp +// Advanced preview options +var options = new PreviewOptions +{ + FileInfo = new FileInfo { FilePath = "source_files/word/source.docx" }, + Format = PreviewOptions.FormatEnum.Jpeg, + OutputFolder = "output", + Width = 800, // Set preview width + Height = 1000, // Set preview height + PageNumbers = new List { 1, 2, 3 }, // Generate previews for specific pages only + Resolution = 150 // DPI resolution +} \ No newline at end of file diff --git a/content/comparison/english/getting-started/get-document-information/_index.md b/content/comparison/english/getting-started/get-document-information/_index.md new file mode 100644 index 0000000..31c73d6 --- /dev/null +++ b/content/comparison/english/getting-started/get-document-information/_index.md @@ -0,0 +1,288 @@ +--- +title: How to Get Document Information with GroupDocs.Comparison Cloud Tutorial +weight: 2 +description: Learn how to extract document metadata and properties from files before comparison using GroupDocs.Comparison Cloud API in this step-by-step tutorial +url: /getting-started/get-document-information/ +--- + +# Tutorial: How to Get Document Information with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Retrieve essential information about documents before comparison +- Extract document properties like format, extension, size, and page count +- Implement document info extraction in different programming languages +- Use this information to prepare for document comparison + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps) +- Your Client ID and Client Secret credentials +- A document uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding Document Information + +Before comparing documents, it's often necessary to gather information about them. GroupDocs.Comparison Cloud API provides a dedicated endpoint to retrieve important document metadata, including: + +- Document file format +- File extension +- File size +- Number of pages + +This information is crucial for making informed decisions about document comparison settings. + +## Step 1: Upload a Document (If Needed) + +Before retrieving document information, make sure you have uploaded a document to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To get document information, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`POST https://api.groupdocs.cloud/v2.0/comparison/info` + +This endpoint requires a JSON body with the document's file path. + +## Step 3: Implementing with cURL + +Let's start with a cURL example to understand the request and response format: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to get document information +curl -v "https://api.groupdocs.cloud/v2.0/comparison/info" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FilePath': 'source_files/word/source.docx' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will be a JSON object containing document metadata: + +```json +{ + "format": "Microsoft Word Document", + "extension": ".docx", + "size": 23059, + "pageCount": 1 +} +``` + +## Step 4: Implementing with SDKs + +Now let's implement the same functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace GetDocumentInfoExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + var infoApi = new InfoApi(configuration); + + // Prepare request + var fileInfo = new FileInfo + { + FilePath = "source_files/word/source.docx" + }; + var request = new GetDocumentInfoRequest(fileInfo); + + try + { + // Get document information + var response = infoApi.GetDocumentInfo(request); + + // Display document information + Console.WriteLine($"Document format: {response.Format}"); + Console.WriteLine($"Extension: {response.Extension}"); + Console.WriteLine($"Size: {response.Size} bytes"); + Console.WriteLine($"Page count: {response.PageCount}"); + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import GetDocumentInfoRequest + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create InfoApi instance +info_api = groupdocs_comparison_cloud.InfoApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare request +file_info = groupdocs_comparison_cloud.FileInfo() +file_info.file_path = "source_files/word/source.docx" +request = GetDocumentInfoRequest(file_info) + +try: + # Get document information + response = info_api.get_document_info(request) + + # Display document information + print(f"Document format: {response.format}") + print(f"Extension: {response.extension}") + print(f"Size: {response.size} bytes") + print(f"Page count: {response.page_count}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.InfoApi; +import com.groupdocs.cloud.comparison.model.requests.GetDocumentInfoRequest; + +public class GetDocumentInfoExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + InfoApi infoApi = new InfoApi(configuration); + + // Prepare request + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("source_files/word/source.docx"); + GetDocumentInfoRequest request = new GetDocumentInfoRequest(fileInfo); + + try { + // Get document information + InfoResult response = infoApi.getDocumentInfo(request); + + // Display document information + System.out.println("Document format: " + response.getFormat()); + System.out.println("Extension: " + response.getExtension()); + System.out.println("Size: " + response.getSize() + " bytes"); + System.out.println("Page count: " + response.getPageCount()); + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create InfoApi instance +const infoApi = comparison.InfoApi.fromKeys(clientId, clientSecret); + +// Prepare request +const fileInfo = new comparison.FileInfo(); +fileInfo.filePath = "source_files/word/source.docx"; + +// Get document information +infoApi.getDocumentInfo(new comparison.GetDocumentInfoRequest(fileInfo)) + .then(response => { + console.log("Document format:", response.format); + console.log("Extension:", response.extension); + console.log("Size:", response.size, "bytes"); + console.log("Page count:", response.pageCount); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: Practical Application + +Now that you can retrieve document information, here are some practical uses for this functionality: + +1. Validating Documents: Check if a document has the expected properties before comparison +2. User Interface Updates: Show document information to users before they compare documents +3. Progress Estimation: Use page count to estimate comparison time +4. Storage Management: Track document sizes to manage cloud storage usage +5. Format Compatibility Check: Ensure documents being compared are compatible formats + +## Try It Yourself + +Now it's your turn to practice: + +1. Upload different types of documents to your cloud storage +2. Retrieve information for each document using the code examples +3. Create a function that validates documents based on their properties +4. Build a simple interface that displays document information to users + +## Troubleshooting Tips + +- 404 Not Found: Ensure the document exists at the specified path +- 401 Unauthorized: Verify your Client ID and Client Secret +- File Format Issues: Confirm the document is in a supported format +- Empty Response: Check that the document is not corrupted + +## What You've Learned + +In this tutorial, you've learned: +- How to retrieve essential document information before comparison +- How to extract document properties like format, extension, size, and page count +- How to implement document information extraction in different programming languages +- How to use this information to prepare for document comparison + +## Next Steps + +Now that you can retrieve document information, you're ready to move on to actual document comparison. Continue to the next tutorial: +- [Tutorial: How to Compare Documents](/getting-started/compare-documents/) + +This will teach you how to compare two documents and identify differences between them. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/getting-started/get-document-information/get-document-information-tutorial.md b/content/comparison/english/getting-started/get-document-information/get-document-information-tutorial.md new file mode 100644 index 0000000..46f93e8 --- /dev/null +++ b/content/comparison/english/getting-started/get-document-information/get-document-information-tutorial.md @@ -0,0 +1,292 @@ +--- +id: "get-document-information-tutorial" +url: /getting-started/get-document-information" +title: "Tutorial: How to Get Document Information with GroupDocs.Comparison Cloud" +productName: "GroupDocs.Comparison Cloud" +weight: 2 +description: "Learn how to extract document metadata and properties from files before comparison using GroupDocs.Comparison Cloud API in this step-by-step tutorial" +keywords: "document comparison tutorial, get document info, extract file metadata, groupdocs cloud api tutorial" +toc: True +--- + +# Tutorial: How to Get Document Information with GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Retrieve essential information about documents before comparison +- Extract document properties like format, extension, size, and page count +- Implement document info extraction in different programming languages +- Use this information to prepare for document comparison + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret credentials +- A document uploaded to your GroupDocs Cloud Storage +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding Document Information + +Before comparing documents, it's often necessary to gather information about them. GroupDocs.Comparison Cloud API provides a dedicated endpoint to retrieve important document metadata, including: + +- Document file format +- File extension +- File size +- Number of pages + +This information is crucial for making informed decisions about document comparison settings. + +## Step 1: Upload a Document (If Needed) + +Before retrieving document information, make sure you have uploaded a document to your cloud storage. For detailed instructions on file uploads, refer to the [File API documentation](https://docs.groupdocs.cloud/comparison/developer-guide/working-with-file-api/). + +## Step 2: Understanding the API Resource + +To get document information, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`POST https://api.groupdocs.cloud/v2.0/comparison/info` + +This endpoint requires a JSON body with the document's file path. + +## Step 3: Implementing with cURL + +Let's start with a cURL example to understand the request and response format: + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to get document information +curl -v "https://api.groupdocs.cloud/v2.0/comparison/info" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FilePath': 'source_files/word/source.docx' +}" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will be a JSON object containing document metadata: + +```json +{ + "format": "Microsoft Word Document", + "extension": ".docx", + "size": 23059, + "pageCount": 1 +} +``` + +## Step 4: Implementing with SDKs + +Now let's implement the same functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; +using GroupDocs.Comparison.Cloud.Sdk.Model; +using GroupDocs.Comparison.Cloud.Sdk.Model.Requests; + +namespace GetDocumentInfoExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + var infoApi = new InfoApi(configuration); + + // Prepare request + var fileInfo = new FileInfo + { + FilePath = "source_files/word/source.docx" + }; + var request = new GetDocumentInfoRequest(fileInfo); + + try + { + // Get document information + var response = infoApi.GetDocumentInfo(request); + + // Display document information + Console.WriteLine($"Document format: {response.Format}"); + Console.WriteLine($"Extension: {response.Extension}"); + Console.WriteLine($"Size: {response.Size} bytes"); + Console.WriteLine($"Page count: {response.PageCount}"); + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import GetDocumentInfoRequest + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create InfoApi instance +info_api = groupdocs_comparison_cloud.InfoApi.from_keys( + configuration.client_id, configuration.client_secret +) + +# Prepare request +file_info = groupdocs_comparison_cloud.FileInfo() +file_info.file_path = "source_files/word/source.docx" +request = GetDocumentInfoRequest(file_info) + +try: + # Get document information + response = info_api.get_document_info(request) + + # Display document information + print(f"Document format: {response.format}") + print(f"Extension: {response.extension}") + print(f"Size: {response.size} bytes") + print(f"Page count: {response.page_count}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.InfoApi; +import com.groupdocs.cloud.comparison.model.requests.GetDocumentInfoRequest; + +public class GetDocumentInfoExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + InfoApi infoApi = new InfoApi(configuration); + + // Prepare request + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("source_files/word/source.docx"); + GetDocumentInfoRequest request = new GetDocumentInfoRequest(fileInfo); + + try { + // Get document information + InfoResult response = infoApi.getDocumentInfo(request); + + // Display document information + System.out.println("Document format: " + response.getFormat()); + System.out.println("Extension: " + response.getExtension()); + System.out.println("Size: " + response.getSize() + " bytes"); + System.out.println("Page count: " + response.getPageCount()); + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create InfoApi instance +const infoApi = comparison.InfoApi.fromKeys(clientId, clientSecret); + +// Prepare request +const fileInfo = new comparison.FileInfo(); +fileInfo.filePath = "source_files/word/source.docx"; + +// Get document information +infoApi.getDocumentInfo(new comparison.GetDocumentInfoRequest(fileInfo)) + .then(response => { + console.log("Document format:", response.format); + console.log("Extension:", response.extension); + console.log("Size:", response.size, "bytes"); + console.log("Page count:", response.pageCount); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 5: Practical Application + +Now that you can retrieve document information, here are some practical uses for this functionality: + +1. Validating Documents: Check if a document has the expected properties before comparison +2. User Interface Updates: Show document information to users before they compare documents +3. Progress Estimation: Use page count to estimate comparison time +4. Storage Management: Track document sizes to manage cloud storage usage +5. Format Compatibility Check: Ensure documents being compared are compatible formats + +## Try It Yourself + +Now it's your turn to practice: + +1. Upload different types of documents to your cloud storage +2. Retrieve information for each document using the code examples +3. Create a function that validates documents based on their properties +4. Build a simple interface that displays document information to users + +## Troubleshooting Tips + +- 404 Not Found: Ensure the document exists at the specified path +- 401 Unauthorized: Verify your Client ID and Client Secret +- File Format Issues: Confirm the document is in a supported format +- Empty Response: Check that the document is not corrupted + +## What You've Learned + +In this tutorial, you've learned: +- How to retrieve essential document information before comparison +- How to extract document properties like format, extension, size, and page count +- How to implement document information extraction in different programming languages +- How to use this information to prepare for document comparison + +## Next Steps + +Now that you can retrieve document information, you're ready to move on to actual document comparison. Continue to the next tutorial: +- [Tutorial: How to Compare Documents](/getting-started/compare-documents) + +This will teach you how to compare two documents and identify differences between them. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/getting-started/get-supported-file-formats/_index.md b/content/comparison/english/getting-started/get-supported-file-formats/_index.md new file mode 100644 index 0000000..195b4cb --- /dev/null +++ b/content/comparison/english/getting-started/get-supported-file-formats/_index.md @@ -0,0 +1,251 @@ +--- +title: How to Get Supported File Formats in GroupDocs.Comparison Cloud Tutorial +weight: 1 +description: Learn how to retrieve all supported file formats for document comparison using GroupDocs.Comparison Cloud API in this beginner-friendly tutoria +url: /getting-started/get-supported-file-formats/ +--- + +# Tutorial: How to Get Supported File Formats in GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Make API calls to retrieve all supported file formats for document comparison +- Implement this functionality in different programming languages +- Process and display the list of supported formats in your application + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps) +- Your Client ID and Client Secret credentials +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding the API + +GroupDocs.Comparison Cloud API allows you to compare documents of various formats. Before comparing documents, it's important to know which file formats are supported. The API provides a dedicated endpoint to retrieve this information. + +## Step 1: Understanding the Resource + +To get the list of supported file formats, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`GET https://api.groupdocs.cloud/v2.0/comparison/formats` + +This endpoint returns a complete list of file formats that can be compared using the API. + +## Step 2: Implementing with cURL + +Let's start with a simple cURL example to understand the request and response format. + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to get supported formats +curl -v "https://api.groupdocs.cloud/v2.0/comparison/formats" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will be a JSON object containing an array of supported formats with their extensions and descriptions: + +```json +{ + "formats": [ + { + "extension": ".pdf", + "fileFormat": "Portable Document Format" + }, + { + "extension": ".doc", + "fileFormat": "Microsoft Word" + }, + ... + ] +} +``` + +## Step 3: Implementing with SDK + +Now let's implement the same functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; + +namespace GetSupportedFormatsExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + var infoApi = new InfoApi(configuration); + + try + { + // Get supported file formats + var formats = infoApi.GetSupportedFileFormats(); + + Console.WriteLine("Supported formats:"); + // Display each supported format + foreach (var format in formats.Formats) + { + Console.WriteLine($"{format.FileFormat}: {format.Extension}"); + } + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import Configuration + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create InfoApi instance +api = groupdocs_comparison_cloud.InfoApi.from_config(configuration) + +try: + # Retrieve supported file formats + response = api.get_supported_file_formats() + + # Display the supported formats + print("Supported formats:") + for format_info in response.formats: + print(f"{format_info.file_format}: {format_info.extension}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.InfoApi; + +public class GetSupportedFormatsExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + InfoApi infoApi = new InfoApi(configuration); + + try { + // Retrieve supported file formats + FormatsResult response = infoApi.getSupportedFileFormats(); + + // Display the supported formats + System.out.println("Supported formats:"); + for (Format format : response.getFormats()) { + System.out.println(format.getFileFormat() + ": " + format.getExtension()); + } + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create InfoApi instance +const infoApi = comparison.InfoApi.fromKeys(clientId, clientSecret); + +// Retrieve supported file formats +infoApi.getSupportedFileFormats() + .then(result => { + console.log("Supported formats:"); + result.formats.forEach(format => { + console.log(`${format.fileFormat}: ${format.extension}`); + }); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 4: Analyzing the Results + +After running any of these examples, you'll receive a list of supported file formats. Let's analyze what information we get: + +1. File Extension: The file extension (e.g., `.pdf`, `.docx`) +2. File Format: The name of the document format (e.g., "Portable Document Format", "Microsoft Word") + +This information is crucial for: +- Validating input files before attempting comparison +- Building user interfaces that show supported formats +- Filtering documents in your application based on comparison capability + +## Try It Yourself + +Now it's your turn to practice: + +1. Implement the code example in your preferred language +2. Modify the code to filter formats by category (e.g., only Microsoft Office formats) +3. Create a simple UI that displays the supported formats to users + +## Troubleshooting Tips + +- 401 Unauthorized: Ensure your Client ID and Client Secret are correct +- API Connection Issues: Check your network connection and firewall settings +- SDK Not Working: Verify you have the latest version of the SDK installed + +## What You've Learned + +In this tutorial, you've learned: +- How to authenticate with the GroupDocs.Comparison Cloud API +- How to retrieve a list of supported file formats +- How to implement this functionality in different programming languages +- How to process and use the format information in your applications + +## Next Steps + +Now that you know which formats are supported, you can proceed to the next tutorial: +- [Tutorial: How to Get Document Information](/getting-started/get-document-information/) + +This will teach you how to extract essential information from documents before comparing them. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/comparison/english/getting-started/get-supported-file-formats/get-supported-file-formats-tutorial.md b/content/comparison/english/getting-started/get-supported-file-formats/get-supported-file-formats-tutorial.md new file mode 100644 index 0000000..6a5956e --- /dev/null +++ b/content/comparison/english/getting-started/get-supported-file-formats/get-supported-file-formats-tutorial.md @@ -0,0 +1,255 @@ +--- +id: "get-supported-file-formats-tutorial" +url: /getting-started/get-supported-file-formats" +title: "Tutorial: How to Get Supported File Formats in GroupDocs.Comparison Cloud" +productName: "GroupDocs.Comparison Cloud" +weight: 1 +description: "Learn how to retrieve all supported file formats for document comparison using GroupDocs.Comparison Cloud API in this beginner-friendly tutorial" +keywords: "comparison api tutorial, get supported formats, document comparison tutorial, groupdocs cloud api" +toc: True +--- + +# Tutorial: How to Get Supported File Formats in GroupDocs.Comparison Cloud + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Make API calls to retrieve all supported file formats for document comparison +- Implement this functionality in different programming languages +- Process and display the list of supported formats in your application + +## Prerequisites + +Before starting this tutorial, you'll need: +- A GroupDocs.Comparison Cloud account (get a [free trial here](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret credentials +- Basic familiarity with RESTful APIs and your chosen programming language + +## Understanding the API + +GroupDocs.Comparison Cloud API allows you to compare documents of various formats. Before comparing documents, it's important to know which file formats are supported. The API provides a dedicated endpoint to retrieve this information. + +## Step 1: Understanding the Resource + +To get the list of supported file formats, we'll use the following GroupDocs.Comparison Cloud REST API resource: + +`GET https://api.groupdocs.cloud/v2.0/comparison/formats` + +This endpoint returns a complete list of file formats that can be compared using the API. + +## Step 2: Implementing with cURL + +Let's start with a simple cURL example to understand the request and response format. + +```bash +# First, get the JWT token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Use the token to get supported formats +curl -v "https://api.groupdocs.cloud/v2.0/comparison/formats" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" +``` + +Replace `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET`, and `YOUR_JWT_TOKEN` with your actual credentials. + +The response will be a JSON object containing an array of supported formats with their extensions and descriptions: + +```json +{ + "formats": [ + { + "extension": ".pdf", + "fileFormat": "Portable Document Format" + }, + { + "extension": ".doc", + "fileFormat": "Microsoft Word" + }, + ... + ] +} +``` + +## Step 3: Implementing with SDK + +Now let's implement the same functionality using various SDKs. + +### C# Example + +```csharp +using System; +using GroupDocs.Comparison.Cloud.Sdk.Api; +using GroupDocs.Comparison.Cloud.Sdk.Client; + +namespace GetSupportedFormatsExample +{ + class Program + { + static void Main(string[] args) + { + // Configure API credentials + var configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + var infoApi = new InfoApi(configuration); + + try + { + // Get supported file formats + var formats = infoApi.GetSupportedFileFormats(); + + Console.WriteLine("Supported formats:"); + // Display each supported format + foreach (var format in formats.Formats) + { + Console.WriteLine($"{format.FileFormat}: {format.Extension}"); + } + } + catch (Exception e) + { + Console.WriteLine($"Error: {e.Message}"); + } + } + } +} +``` + +### Python Example + +```python +import groupdocs_comparison_cloud +from groupdocs_comparison_cloud import Configuration + +# Configure API credentials +configuration = groupdocs_comparison_cloud.Configuration( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET" +) + +# Create InfoApi instance +api = groupdocs_comparison_cloud.InfoApi.from_config(configuration) + +try: + # Retrieve supported file formats + response = api.get_supported_file_formats() + + # Display the supported formats + print("Supported formats:") + for format_info in response.formats: + print(f"{format_info.file_format}: {format_info.extension}") +except groupdocs_comparison_cloud.ApiException as e: + print(f"Error: {e}") +``` + +### Java Example + +```java +import com.groupdocs.cloud.comparison.client.*; +import com.groupdocs.cloud.comparison.model.*; +import com.groupdocs.cloud.comparison.api.InfoApi; + +public class GetSupportedFormatsExample { + public static void main(String[] args) { + // Configure API credentials + Configuration configuration = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"); + + // Create InfoApi instance + InfoApi infoApi = new InfoApi(configuration); + + try { + // Retrieve supported file formats + FormatsResult response = infoApi.getSupportedFileFormats(); + + // Display the supported formats + System.out.println("Supported formats:"); + for (Format format : response.getFormats()) { + System.out.println(format.getFileFormat() + ": " + format.getExtension()); + } + } catch (ApiException e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +### Node.js Example + +```javascript +// Load the GroupDocs.Comparison Cloud SDK +const comparison = require("groupdocs-comparison-cloud"); + +// Configure API credentials +const clientId = "YOUR_CLIENT_ID"; +const clientSecret = "YOUR_CLIENT_SECRET"; + +// Create InfoApi instance +const infoApi = comparison.InfoApi.fromKeys(clientId, clientSecret); + +// Retrieve supported file formats +infoApi.getSupportedFileFormats() + .then(result => { + console.log("Supported formats:"); + result.formats.forEach(format => { + console.log(`${format.fileFormat}: ${format.extension}`); + }); + }) + .catch(error => { + console.log("Error:", error.message); + }); +``` + +## Step 4: Analyzing the Results + +After running any of these examples, you'll receive a list of supported file formats. Let's analyze what information we get: + +1. File Extension: The file extension (e.g., `.pdf`, `.docx`) +2. File Format: The name of the document format (e.g., "Portable Document Format", "Microsoft Word") + +This information is crucial for: +- Validating input files before attempting comparison +- Building user interfaces that show supported formats +- Filtering documents in your application based on comparison capability + +## Try It Yourself + +Now it's your turn to practice: + +1. Implement the code example in your preferred language +2. Modify the code to filter formats by category (e.g., only Microsoft Office formats) +3. Create a simple UI that displays the supported formats to users + +## Troubleshooting Tips + +- 401 Unauthorized: Ensure your Client ID and Client Secret are correct +- API Connection Issues: Check your network connection and firewall settings +- SDK Not Working: Verify you have the latest version of the SDK installed + +## What You've Learned + +In this tutorial, you've learned: +- How to authenticate with the GroupDocs.Comparison Cloud API +- How to retrieve a list of supported file formats +- How to implement this functionality in different programming languages +- How to process and use the format information in your applications + +## Next Steps + +Now that you know which formats are supported, you can proceed to the next tutorial: +- [Tutorial: How to Get Document Information](/getting-started/get-document-information) + +This will teach you how to extract essential information from documents before comparing them. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/comparison/) +- [Documentation](https://docs.groupdocs.cloud/comparison/) +- [API Reference](https://reference.groupdocs.cloud/comparison/) +- [Free Support Forum](https://forum.groupdocs.cloud/c/annotation/12/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) + diff --git a/content/home/english/_index.md b/content/home/english/_index.md index 178a836..1504686 100644 --- a/content/home/english/_index.md +++ b/content/home/english/_index.md @@ -26,7 +26,7 @@ Discover how to join multiple documents into one, split documents into parts, ma ### [GroupDocs.Annotation Cloud Tutorials](./annotation/) Explore our tutorials on adding, editing, and managing annotations in documents. Learn to implement comments, highlights, text markup, and various other annotation tools in your applications. -### [GroupDocs.Comparison Cloud Tutorials](#) +### [GroupDocs.Comparison Cloud Tutorials](./comarison/) Learn document comparison techniques with our step-by-step guides for detecting changes between document versions, generating visual difference reports, and managing tracked changes. ### [GroupDocs.Editor Cloud Tutorials](#)