From 2f358b665b14a9636825062e3ab68d156bc43e7c Mon Sep 17 00:00:00 2001 From: Muhammad Muqarrab Date: Thu, 21 Aug 2025 17:26:07 +0500 Subject: [PATCH 1/2] Add Signature config files --- .github/workflows/signature-production.yml | 69 ++++++++++ .github/workflows/signature-staging.yml | 69 ++++++++++ config/signature/_default/config.toml | 150 +++++++++++++++++++++ config/signature/production/config.toml | 9 ++ config/signature/staging/config.toml | 8 ++ content/home/english/_index.md | 2 +- 6 files changed, 306 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/signature-production.yml create mode 100644 .github/workflows/signature-staging.yml create mode 100644 config/signature/_default/config.toml create mode 100644 config/signature/production/config.toml create mode 100644 config/signature/staging/config.toml diff --git a/.github/workflows/signature-production.yml b/.github/workflows/signature-production.yml new file mode 100644 index 0000000..226a7ec --- /dev/null +++ b/.github/workflows/signature-production.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: tutorials.groupdocs.cloud(signature)(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/signature/**' + pull_request: + branches: [ master ] + paths: + - 'content/signature/**' + + # 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 signature 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/signature --environment production --minify + + - name: Deploy tutorials.groupdocs.cloud(signature)(family)(Production) to S3 + run: hugo --configDir config/signature --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: /signature/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/.github/workflows/signature-staging.yml b/.github/workflows/signature-staging.yml new file mode 100644 index 0000000..7564f2f --- /dev/null +++ b/.github/workflows/signature-staging.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: qa-tutorials.groupdocs.cloud(signature)(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/signature/**' + pull_request: + branches: [ staging ] + paths: + - 'content/signature/**' + + # 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 signature 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/signature --environment staging --minify + + - name: Deploy qa-tutorials.groupdocs.cloud(signature)(family)(Stage) to S3 + run: hugo --configDir config/signature --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: /signature/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/config/signature/_default/config.toml b/config/signature/_default/config.toml new file mode 100644 index 0000000..ba15552 --- /dev/null +++ b/config/signature/_default/config.toml @@ -0,0 +1,150 @@ +baseURL = "/signature" +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/signature/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/signature/production/config.toml b/config/signature/production/config.toml new file mode 100644 index 0000000..c8edea4 --- /dev/null +++ b/config/signature/production/config.toml @@ -0,0 +1,9 @@ +baseURL = "https://tutorials.groupdocs.cloud/signature" + +# Google Tag Manager settings +[params.gtm] +gtm_id = "GTM-T42TVBC" + +[[deployment.targets]] +name = "Production" +URL = "s3://tutorials.groupdocs.cloud/?prefix=signature/®ion=us-west-2" diff --git a/config/signature/staging/config.toml b/config/signature/staging/config.toml new file mode 100644 index 0000000..92a26e2 --- /dev/null +++ b/config/signature/staging/config.toml @@ -0,0 +1,8 @@ +baseURL = "https://qa-tutorials.groupdocs.cloud/signature" + +[[deployment.targets]] +name = "Stage" +URL = "s3://qa-tutorials.groupdocs.cloud/?prefix=signature /®ion=us-west-2" + + + diff --git a/content/home/english/_index.md b/content/home/english/_index.md index 6534b89..2ea6ea4 100644 --- a/content/home/english/_index.md +++ b/content/home/english/_index.md @@ -40,7 +40,7 @@ Learn document automation and report generation with our practical guides coveri ### [GroupDocs.Parser Cloud Tutorials](./parser/) Discover techniques for extracting text, images, and metadata from various document formats with our comprehensive guides for data extraction and document parsing. -### [GroupDocs.Signature Cloud Tutorials](#) +### [GroupDocs.Signature Cloud Tutorials](./signature/) Master electronic signature implementation with tutorials on adding, verifying, and managing electronic signatures in various document formats. ### [GroupDocs.Metadata Cloud Tutorials](#) From ae322841e1f8b4da752673d9e73d1146141b8d22 Mon Sep 17 00:00:00 2001 From: Muhammad Muqarrab Date: Thu, 21 Aug 2025 17:26:48 +0500 Subject: [PATCH 2/2] Add Signature tutorials --- content/signature/english/_index.md | 92 ++++ .../english/advanced-features/_index.md | 63 +++ .../barcode-signatures/_index.md | 356 ++++++++++++ .../search-barcode-signatures/_index.md | 381 +++++++++++++ .../update-barcode-signatures/_index.md | 521 ++++++++++++++++++ .../english/beginner-guide/_index.md | 46 ++ .../beginner-guide/document-info/_index.md | 341 ++++++++++++ .../beginner-guide/file-formats/_index.md | 260 +++++++++ 8 files changed, 2060 insertions(+) create mode 100644 content/signature/english/_index.md create mode 100644 content/signature/english/advanced-features/_index.md create mode 100644 content/signature/english/advanced-features/barcode-signatures/_index.md create mode 100644 content/signature/english/advanced-features/search-barcode-signatures/_index.md create mode 100644 content/signature/english/advanced-features/update-barcode-signatures/_index.md create mode 100644 content/signature/english/beginner-guide/_index.md create mode 100644 content/signature/english/beginner-guide/document-info/_index.md create mode 100644 content/signature/english/beginner-guide/file-formats/_index.md diff --git a/content/signature/english/_index.md b/content/signature/english/_index.md new file mode 100644 index 0000000..1a8351a --- /dev/null +++ b/content/signature/english/_index.md @@ -0,0 +1,92 @@ +--- +title: "GroupDocs.Signature Cloud API Documentation" +id: "main-documentation" +url: /signature/ +productName: "GroupDocs.Signature Cloud" +weight: 1 +description: "Complete developer guide for GroupDocs.Signature Cloud API covering all data structures, API methods, and workflows for document signature operations including signing, verifying, searching, updating, and deleting signatures." +keywords: "signature api, document signing, digital signatures, barcode signatures, qr code signatures, text signatures, image signatures, stamp signatures, verify signatures, search signatures, update signatures, delete signatures, cloud api" +toc: True +--- + +# GroupDocs.Signature Cloud API Documentation + +## Overview + +Welcome to the GroupDocs.Signature Cloud API documentation. This comprehensive guide covers all data structures and API methods for document signature operations including signing, verifying, searching, updating, and deleting signatures in various document formats. + +## GroupDocs.Signature Tutorials + +- [Advanced Features](/advanced-features/) - Learn to implement advanced document signing features with our step-by-step tutorials for GroupDocs.Signature Cloud API. + +- [Document Beginner Guide Tutorials](./beginner-guide/) - Learn step-by-step how to use GroupDocs.Signature Cloud API with these beginner tutorials for developers. + + +## API Workflow + +### Basic Operations + +1. **Document Information** + ``` + InfoSettings → Info API → InfoResult + ``` + +2. **Document Signing** + ``` + SignSettings → Sign API → SignResult + ``` + +3. **Signature Verification** + ``` + VerifySettings → Verify API → VerifyResult + ``` + +4. **Signature Search** + ``` + SearchSettings → Search API → SearchResult + ``` + +5. **Signature Update** + ``` + UpdateSettings → Update API → UpdateResult + ``` + +6. **Signature Deletion** + ``` + DeleteSettings → Delete API → DeleteResult + ``` + +### Supported Signature Types + +- **Text Signatures**: Custom text with formatting options +- **Image Signatures**: Upload and position image files +- **Digital Signatures**: Cryptographic document signing +- **Barcode Signatures**: Various barcode formats (Code128, etc.) +- **QR Code Signatures**: QR codes with custom data +- **Stamp Signatures**: Multi-line stamp designs + +### Document Format Support + +The API supports various document formats including: +- Microsoft Word (DOC, DOCX) +- PDF documents +- Excel spreadsheets +- PowerPoint presentations +- Image formats + +## Getting Started + +1. Choose the appropriate Settings structure for your operation +2. Configure required parameters (FilePath is mandatory) +3. Set optional parameters as needed (storage, password, etc.) +4. Make API call with the settings object +5. Process the corresponding Result structure response + +## Key Features + +- **Multi-format Support**: Work with various document types +- **Flexible Positioning**: Precise signature placement +- **Rich Styling Options**: Fonts, colors, borders, backgrounds +- **Batch Operations**: Multiple signatures in single request +- **Secure Operations**: Password-protected document support +- **Cloud Storage**: Integration with cloud storage services diff --git a/content/signature/english/advanced-features/_index.md b/content/signature/english/advanced-features/_index.md new file mode 100644 index 0000000..5f6c9e3 --- /dev/null +++ b/content/signature/english/advanced-features/_index.md @@ -0,0 +1,63 @@ +--- +title: "GroupDocs.Signature Cloud API Document Advanced Features Tutorials" +id: "advanced-features-tutorials" +url: /advanced-features/ +productName: "GroupDocs.Signature Cloud" +description: "Learn to implement advanced document signing features with our step-by-step tutorials for GroupDocs.Signature Cloud API" +keywords: "GroupDocs.Signature Cloud, tutorials, advanced features, document signing, API tutorial" +--- + +# GroupDocs.Signature Cloud API Document Advanced Features Tutorials + +Welcome to our comprehensive tutorial series on advanced document signing features using GroupDocs.Signature Cloud API. These hands-on tutorials are designed specifically for developers looking to implement sophisticated electronic signature capabilities in their applications. + +## Learning Path + +This tutorial series follows a logical progression from basic to advanced signature operations. Whether you're looking to implement digital signatures, QR codes, or more complex multi-signature workflows, this learning path will guide you through each step of the process. + +### Prerequisites +- Basic understanding of RESTful APIs +- Familiarity with your programming language of choice (C#, Java, PHP, Node.js, Python, or Ruby) +- GroupDocs.Signature Cloud API credentials (Client ID and Client Secret) +- Development environment with necessary SDK installed + +## Tutorial Listing + +### Signing Documents + +Learn to apply various types of electronic signatures to your documents: + +- [Tutorial: Learn to Sign Documents with Barcode Signatures](/advanced-features/barcode-signatures/) - Create and implement barcode signatures in your documents for enhanced verification capabilities. + +### Searching for Signatures + +Discover how to locate and analyze existing signatures in documents: + +- [Tutorial: How to Search for Barcode Signatures](/advanced-features/search-barcode-signatures/) - Find and extract information from barcode signatures. + +### Updating Signatures + +Master the techniques to modify existing signatures: + +- [Tutorial: Updating Barcode Signatures](/advanced-features/update-barcode-signatures/) - Modify properties of existing barcode signatures. + +## What You'll Learn + +By completing these tutorials, you'll gain practical knowledge and hands-on experience in: + +- Implementing different signature types in various document formats +- Searching for and extracting signature information +- Verifying the authenticity of signatures +- Managing existing signatures through updates and deletion +- Creating complex multi-signature workflows +- Troubleshooting common signature-related challenges + +## Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/signature/english/advanced-features/barcode-signatures/_index.md b/content/signature/english/advanced-features/barcode-signatures/_index.md new file mode 100644 index 0000000..922f7a9 --- /dev/null +++ b/content/signature/english/advanced-features/barcode-signatures/_index.md @@ -0,0 +1,356 @@ +--- +title: "Learn to Sign Documents with Barcode Signatures" +id: "tutorial-sign-document-with-barcode-signatures" +url: /advanced-features/barcode-signatures/ +productName: "GroupDocs.Signature Cloud" +description: "Learn how to implement barcode signatures in documents using GroupDocs.Signature Cloud API in this step-by-step tutorial" +keywords: "barcode signature tutorial, GroupDocs.Signature Cloud, add barcode signature, document signing tutorial, barcode API" +--- + +# Tutorial: Learn to Sign Documents with Barcode Signatures + +## Introduction + +In this tutorial, you'll learn how to add barcode signatures to documents using GroupDocs.Signature Cloud API. Barcode signatures provide an excellent way to embed machine-readable information into your documents, making them ideal for automated verification and processing systems. + +**Learning Objectives:** +- Understand what barcode signatures are and when to use them +- Learn to create and customize barcode signatures +- Implement barcode signatures in different document formats +- Explore various barcode types and their applications + +## Prerequisites + +Before you begin this tutorial, make sure you have: + +1. A [GroupDocs.Signature Cloud account](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Access to the [API Reference](https://reference.groupdocs.cloud/signature/) +4. Development environment with the necessary SDK installed (examples provided for multiple languages) +5. Basic understanding of RESTful APIs and your programming language of choice + +## What Are Barcode Signatures? + +A barcode signature is a machine-readable representation of data that appears as a series of parallel lines or patterns. When added to a document, it provides a way to embed information that can be quickly scanned and verified by barcode readers. + +Barcodes are commonly used for: +- Product identification +- Inventory management +- Document tracking +- Quick access to specific information + +## Practical Scenario + +Let's consider a practical application: A logistics company needs to embed tracking information in shipping documents. Using barcode signatures allows warehouse staff to scan documents quickly to verify package information without manual data entry. + +## Step-by-Step Implementation + +### Step 1: Upload Your Document to Cloud Storage + +Before adding a barcode signature, you need to upload your document to GroupDocs Cloud Storage. + +```javascript +// First get JSON Web 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" + +// Upload document +curl -v "https://api.groupdocs.cloud/v2.0/signature/storage/file/one-page.docx" \ +-X PUT \ +-H "Content-Type: application/octet-stream" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +--data-binary @/path/to/your/one-page.docx +``` + +### Step 2: Configure Barcode Signature Options + +Now, let's configure the barcode signature with specific properties: + +1. Choose the barcode type (Code128 in our example) +2. Define the text content for the barcode +3. Set the position, size, and appearance properties + +### Step 3: Add the Barcode Signature to Your Document + +With your document uploaded and options configured, you can now add the barcode signature: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/create" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'one-page.docx' + }, + 'Options': [ + { + 'AllPages': true, + 'SignatureType': 'Barcode', + 'BarcodeType': 'Code128', + 'Text': '123456789012', + 'Left': 100, + 'Top': 100, + 'Width': 300, + 'Height': 100 + } + ], + 'SaveOptions': { + 'OutputFilePath': 'signedBarcode_one-page.docx' + } +}" +``` + +### Step 4: Download the Signed Document + +Once the document has been signed, you can download it: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/storage/file/signedBarcode_one-page.docx" \ +-X GET \ +-H "Accept: application/octet-stream" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +--output signedBarcode_one-page.docx +``` + +## Try It Yourself + +Now that you understand the process, try implementing barcode signatures with different settings: + +1. Change the barcode type to "QR_Code" or "DataMatrix" +2. Modify the positioning and size of the barcode +3. Try applying the barcode to specific pages using the `Page` parameter instead of `AllPages` +4. Experiment with different text content to see how it affects the barcode pattern + +## SDK Examples + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-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 SignApi(configuration); + +// Sign options. +var options = new SignBarcodeOptions +{ + SignatureType = SignatureTypeEnum.Barcode, + Text = "123456789012", + BarcodeType = "Code128", + CodeTextAlignment = SignBarcodeOptions.CodeTextAlignmentEnum.None, + Left = 100, + Top = 100, + Width = 300, + Height = 100, + LocationMeasureType = SignTextOptions.LocationMeasureTypeEnum.Pixels, + SizeMeasureType = SignTextOptions.SizeMeasureTypeEnum.Pixels, + // Customize barcode appearance + ForeColor = new Color {Web = "BlueViolet"}, + BackgroundColor = new Color {Web = "DarkOrange"}, + // Specify which page to apply the signature + AllPages = false, + Page = 1 +}; + +// Sign settings. +var signSettings = new SignSettings +{ + FileInfo = new FileInfo { FilePath = "one-page.docx" }, + SaveOptions = new SaveOptions { OutputFilePath = "signedBarcode_one-page.docx" }, + Options = new List { options } +}; + +// Create request. +var request = new CreateSignaturesRequest(signSettings); + +// Call API to apply the signature +var response = apiInstance.CreateSignatures(request); + +// The response contains the download URL and signature details +Console.WriteLine($"Signed document URL: {response.downloadUrl}"); +Console.WriteLine($"Signature ID: {response.succeeded[0].signatureId}"); +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; +String MyClientId = "YOUR_CLIENT_ID"; + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); +SignApi apiInstance = new SignApi(configuration); + +FileInfo fileInfo = new FileInfo(); +fileInfo.setFilePath("one-page.docx"); + +// Configure barcode signature options +SignBarcodeOptions options = new SignBarcodeOptions(); +options.setSignatureType(SignatureTypeEnum.BARCODE); + +// Set signature properties +options.setText("123456789012"); +options.setBarcodeType("Code128"); +options.setCodeTextAlignment(CodeTextAlignmentEnum.NONE); + +// Set signature position on a page +options.setLeft(100); +options.setTop(100); +options.setWidth(300); +options.setHeight(100); +options.setLocationMeasureType(LocationMeasureTypeEnum.PIXELS); +options.setSizeMeasureType(SizeMeasureTypeEnum.PIXELS); + +// Set signature appearance +Color backgroundColor = new Color(); +backgroundColor.setWeb("DarkOrange"); +options.setBackgroundColor(backgroundColor); + +// Set pages for signing +options.setPage(1); +options.setAllPages(false); + +// Configure save options +SaveOptions saveOptions = new SaveOptions(); +saveOptions.setOutputFilePath("signedBarcode_one-page.docx"); + +// Set up the signature request +SignSettings signSettings = new SignSettings(); +signSettings.setFileInfo(fileInfo); +signSettings.addOptionsItem(options); +signSettings.setSaveOptions(saveOptions); + +// Execute the signing operation +CreateSignaturesRequest request = new CreateSignaturesRequest(signSettings); +SignResult response = apiInstance.createSignatures(request); + +// Process the response +System.out.println("Signed document URL: " + response.getDownloadUrl()); +System.out.println("Signature ID: " + response.getSucceeded().get(0).getSignatureId()); +``` + +### Python Example + +```python +# For complete examples, go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-python-samples +import groupdocs_signature_cloud + +# Get your app_sid and app_key at https://dashboard.groupdocs.cloud +client_id = "YOUR_CLIENT_ID" +client_secret = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = groupdocs_signature_cloud.SignApi.from_keys(client_id, client_secret) + +# Document information +file_info = groupdocs_signature_cloud.FileInfo() +file_info.file_path = "one-page.docx" + +# Configure barcode signature options +opts = groupdocs_signature_cloud.SignBarcodeOptions() +opts.signature_type = 'Barcode' +opts.text = '123456789012' +opts.barcode_type = 'Code128' + +# Set signature position on page +opts.left = 100 +opts.top = 100 +opts.width = 300 +opts.height = 100 +opts.location_measure_type = "Pixels" +opts.size_measure_type = "Pixels" + +# Set appearance options +opts.fore_color = groupdocs_signature_cloud.Color() +opts.fore_color.web = "BlueViolet" +opts.background_color = groupdocs_signature_cloud.Color() +opts.background_color.web = "DarkOrange" + +# Set page options +opts.page = 1 +opts.all_pages = False + +# Configure save options +settings = groupdocs_signature_cloud.SignSettings() +settings.options = [opts] +settings.save_options = groupdocs_signature_cloud.SaveOptions() +settings.save_options.output_file_path = "signedBarcode_one-page.docx" +settings.file_info = file_info + +# Execute signing +request = groupdocs_signature_cloud.CreateSignaturesRequest(settings) +response = api.create_signatures(request) + +# Process response +print(f"Signed document URL: {response.download_url}") +if response.succeeded: + print(f"Signature ID: {response.succeeded[0].signature_id}") +``` + +## Advanced Configuration Options + +GroupDocs.Signature Cloud provides several options to customize your barcode signatures: + +### Barcode Types +- **1D Barcodes**: Code128, Code39, EAN13, UPC, etc. +- **2D Barcodes**: DataMatrix, Aztec, PDF417, etc. + +### Appearance Settings +- `ForeColor`: Sets the color of the barcode lines +- `BackgroundColor`: Sets the background color +- `Border`: Configures a border around the barcode +- `RotationAngle`: Rotates the barcode on the page + +### Positioning Options +- `HorizontalAlignment`: Aligns the barcode horizontally (Left, Center, Right) +- `VerticalAlignment`: Aligns the barcode vertically (Top, Center, Bottom) +- `Margin`: Sets the spacing around the barcode + +## Troubleshooting + +### Common Issues + +**Issue**: Barcode is not readable by scanners. +**Solution**: Ensure the barcode dimensions are adequate and the text content follows the required format for the specific barcode type. + +**Issue**: API returns an error about invalid barcode type. +**Solution**: Verify that you're using a supported barcode type. Use the [Get Supported Barcode Types](https://reference.groupdocs.cloud/signature/#/Signature/GetSupportedBarcodes) endpoint to check. + +**Issue**: Barcode appears in wrong position or size. +**Solution**: Ensure you're using consistent measurement units (pixels, percentages, etc.) for positioning and sizing. + +## What You've Learned + +In this tutorial, you've learned: +- How to add barcode signatures to documents using GroupDocs.Signature Cloud API +- The structure and configuration options for barcode signatures +- Implementation with different programming languages (C#, Java, Python) +- How to customize the appearance and positioning of barcodes +- Troubleshooting common issues + +## Further Practice + +To reinforce your learning, try these exercises: + +1. Create a document with multiple different barcode types +2. Implement a barcode signature with custom border and rotation +3. Generate a document with barcodes positioned at different page locations +4. Create a program that automatically generates shipping documents with barcode signatures + +## Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/signature/english/advanced-features/search-barcode-signatures/_index.md b/content/signature/english/advanced-features/search-barcode-signatures/_index.md new file mode 100644 index 0000000..97ff80d --- /dev/null +++ b/content/signature/english/advanced-features/search-barcode-signatures/_index.md @@ -0,0 +1,381 @@ +--- +title: "Search for Barcode Signatures" +id: "tutorial-search-for-barcode-signatures" +url: /advanced-features/search-barcode-signatures/ +productName: "GroupDocs.Signature Cloud" +description: "Learn how to search for and extract information from barcode signatures in documents using GroupDocs.Signature Cloud API" +keywords: "barcode search tutorial, GroupDocs.Signature Cloud, find barcode, extract barcode data, document signatures tutorial" +toc: true +--- + +# Tutorial: How to Search for Barcode Signatures + +## Introduction + +In this tutorial, you'll learn how to search for barcode signatures in documents using GroupDocs.Signature Cloud API. Finding and extracting information from barcodes is crucial for document verification, data extraction, and automated processing workflows. + +**Learning Objectives:** +- Understand the barcode searching capabilities of GroupDocs.Signature Cloud +- Learn to configure search options for different barcode types +- Implement barcode search functionality in your applications +- Extract and process data from discovered barcodes + +## Prerequisites + +Before starting this tutorial, make sure you have: + +1. A [GroupDocs.Signature Cloud account](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Access to the [API Reference](https://reference.groupdocs.cloud/signature/) +4. Development environment with the necessary SDK installed +5. A document with barcode signatures that you want to search + +## Why Search for Barcode Signatures? + +Searching for barcodes in documents enables several valuable use cases: + +- **Automated Document Verification**: Quickly validate if specific barcodes exist in documents +- **Data Extraction**: Pull encoded information from barcodes for further processing +- **Document Classification**: Sort documents based on contained barcode types or values +- **Content Auditing**: Identify all barcodes present in a document repository + +## Practical Scenario + +Let's consider a practical application: An invoice processing system needs to extract tracking numbers from shipping documents. Each document contains barcode signatures encoding shipment IDs, and the system must identify and extract this information automatically. + +## Step-by-Step Implementation + +### Step 1: Upload a Document with Barcode Signatures to Cloud Storage + +First, let's upload a document containing barcode signatures: + +```javascript +// First get JSON Web 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" + +// Upload document +curl -v "https://api.groupdocs.cloud/v2.0/signature/storage/file/signedBarcode_one-page.docx" \ +-X PUT \ +-H "Content-Type: application/octet-stream" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +--data-binary @/path/to/your/signedBarcode_one-page.docx +``` + +### Step 2: Configure Barcode Search Options + +Now, let's configure options for searching barcode signatures: + +1. Specify the signature type as "Barcode" +2. Optionally define the barcode type to search for +3. Set specific text to match in the barcode content +4. Configure page settings (search all pages or specific pages) + +### Step 3: Execute the Barcode Search + +With your document uploaded and search options configured, you can now search for barcodes: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/search" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'signedBarcode_one-page.docx' + }, + 'Options': [ + { + 'AllPages': true, + 'SignatureType': 'Barcode', + 'BarcodeType': 'Code128', + 'Text': '123456789012', + 'MatchType': 'Contains' + } + ] +}" +``` + +### Step 4: Process the Search Results + +The API will return information about all matching barcode signatures: + +```javascript +{ + "fileInfo": { + "filePath": "signedBarcode_one-page.docx", + "storageName": null, + "versionId": null, + "password": null + }, + "size": 1360015, + "signatures": [ + { + "barcodeType": "Code128", + "text": "123456789012", + "format": "Portable Network Graphic", + "signatureType": "Barcode", + "pageNumber": 1, + "signatureId": "114bc076-f734-4edf-9ce4-2277725a6ea5", + "isSignature": true, + "createdOn": "2020-07-22T07:45:01.6812929+00:00", + "modifiedOn": "2020-07-22T07:45:01.6812929+00:00", + "top": 100, + "left": 100, + "width": 300, + "height": 100 + } + ] +} +``` + +## Try It Yourself + +Now that you understand the process, try implementing barcode searches with different criteria: + +1. Search for barcodes with different match types (Contains, StartsWith, EndsWith, Exact) +2. Look for various barcode types in the same document +3. Search for barcodes on specific pages using the Page parameter +4. Experiment with different text patterns to find partial matches + +## SDK Examples + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-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 SignApi(configuration); + +// Search options. +var options = new SearchBarcodeOptions +{ + SignatureType = SignatureTypeEnum.Barcode, + // Specify search criteria + MatchType = SearchBarcodeOptions.MatchTypeEnum.Contains, + Text = "123456789012", + BarcodeType = "Code128", + // Specify which pages to search + AllPages = true, + // Alternatively, search specific pages + // Page = 1, + // PagesSetup = new PagesSetup + // { + // EvenPages = false, + // FirstPage = true, + // LastPage = false, + // OddPages = false, + // PageNumbers = new List {1} + // } +}; + +// Search settings. +var searchSettings = new SearchSettings +{ + FileInfo = new FileInfo + { + FilePath = "signedBarcode_one-page.docx" + }, + Options = new List { options } +}; + +// Create request. +var request = new SearchSignaturesRequest(searchSettings); + +// Call api method with request. +var response = apiInstance.SearchSignatures(request); + +// Process results +Console.WriteLine($"Document: {response.fileInfo.filePath}"); +Console.WriteLine($"Found signatures: {response.signatures.Count}"); + +foreach (var signature in response.signatures) +{ + Console.WriteLine($"Barcode type: {signature.barcodeType}"); + Console.WriteLine($"Text: {signature.text}"); + Console.WriteLine($"Page number: {signature.pageNumber}"); + Console.WriteLine($"Signature ID: {signature.signatureId}"); + Console.WriteLine($"Position: Top={signature.top}, Left={signature.left}"); + Console.WriteLine($"Size: Width={signature.width}, Height={signature.height}"); + Console.WriteLine("-----------------------------------"); +} +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; +String MyClientId = "YOUR_CLIENT_ID"; + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); +SignApi apiInstance = new SignApi(configuration); + +FileInfo fileInfo = new FileInfo(); +fileInfo.setFilePath("signedBarcode_one-page.docx"); + +// Configure barcode search options +SearchBarcodeOptions options = new SearchBarcodeOptions(); +options.setSignatureType(SignatureTypeEnum.BARCODE); + +// Set search criteria +options.setBarcodeType("Code128"); +options.setText("123456789012"); +options.setMatchType(MatchTypeEnum.CONTAINS); + +// Set page options +options.setPage(1); +options.setAllPages(true); + +// Configure search settings +SearchSettings searchSettings = new SearchSettings(); +searchSettings.setFileInfo(fileInfo); +searchSettings.addOptionsItem(options); + +// Create and execute the search request +SearchSignaturesRequest request = new SearchSignaturesRequest(searchSettings); +SearchResult response = apiInstance.searchSignatures(request); + +// Process results +System.out.println("Document: " + response.getFileInfo().getFilePath()); +System.out.println("Found signatures: " + response.getSignatures().size()); + +for (SignatureInfo signature : response.getSignatures()) { + BarcodeSignature barcodeSignature = (BarcodeSignature) signature; + System.out.println("Barcode type: " + barcodeSignature.getBarcodeType()); + System.out.println("Text: " + barcodeSignature.getText()); + System.out.println("Page number: " + barcodeSignature.getPageNumber()); + System.out.println("Signature ID: " + barcodeSignature.getSignatureId()); + System.out.println("Position: Top=" + barcodeSignature.getTop() + + ", Left=" + barcodeSignature.getLeft()); + System.out.println("Size: Width=" + barcodeSignature.getWidth() + + ", Height=" + barcodeSignature.getHeight()); + System.out.println("-----------------------------------"); +} +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-python-samples +import groupdocs_signature_cloud + +# Get your app_sid and app_key at https://dashboard.groupdocs.cloud +client_id = "YOUR_CLIENT_ID" +client_secret = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = groupdocs_signature_cloud.SignApi.from_keys(client_id, client_secret) + +# Document information +file_info = groupdocs_signature_cloud.FileInfo() +file_info.file_path = "signedBarcode_one-page.docx" + +# Configure barcode search options +opts = groupdocs_signature_cloud.SearchBarcodeOptions() +opts.signature_type = 'Barcode' +opts.barcode_type = 'Code128' +opts.text = '123456789012' +opts.match_type = 'Contains' +opts.page = 1 +opts.all_pages = True + +# Configure search settings +settings = groupdocs_signature_cloud.SearchSettings() +settings.options = [opts] +settings.file_info = file_info + +# Execute search request +request = groupdocs_signature_cloud.SearchSignaturesRequest(settings) +response = api.search_signatures(request) + +# Process results +print(f"Document: {response.file_info.file_path}") +print(f"Found signatures: {len(response.signatures)}") + +for signature in response.signatures: + print(f"Barcode type: {signature.barcode_type}") + print(f"Text: {signature.text}") + print(f"Page number: {signature.page_number}") + print(f"Signature ID: {signature.signature_id}") + print(f"Position: Top={signature.top}, Left={signature.left}") + print(f"Size: Width={signature.width}, Height={signature.height}") + print("-----------------------------------") +``` + +## Advanced Search Options + +### Match Types +GroupDocs.Signature Cloud provides several matching options for text search: + +- **Contains**: Finds barcodes where the text contains the search string +- **StartsWith**: Matches barcodes where the text starts with the search string +- **EndsWith**: Matches barcodes where the text ends with the search string +- **Exact**: Requires an exact match of the entire barcode text + +### Barcode Types +You can search for specific barcode types by setting the `BarcodeType` property: + +- For 1D barcodes: Code128, Code39, EAN13, etc. +- For 2D barcodes (if they're stored as barcode signatures): DataMatrix, PDF417, etc. + +### Page Selection Options +Control which pages are searched: + +- `AllPages`: Search the entire document +- `Page`: Search a specific page number +- `PagesSetup`: Configure advanced page filtering: + - `FirstPage`: Only search the first page + - `LastPage`: Only search the last page + - `OddPages`: Only search odd-numbered pages + - `EvenPages`: Only search even-numbered pages + - `PageNumbers`: Search specific page numbers in a list + +## Troubleshooting + +### Common Issues + +**Issue**: No barcodes found despite being present in the document. +**Solution**: Ensure the barcode type and text criteria match what's in the document. Try using broader search criteria first (e.g., `AllPages = true` and no text criteria) and then narrow down. + +**Issue**: Barcode text not matching expected format. +**Solution**: Barcode data may include hidden characters or different formatting. Try using the "Contains" match type instead of "Exact". + +**Issue**: Search taking too long for large documents. +**Solution**: Limit the search to specific pages if you know where the barcodes are likely to be located. + +## What You've Learned + +In this tutorial, you've learned: +- How to search for barcode signatures in documents using GroupDocs.Signature Cloud API +- Configuring search options for barcode types, text content, and page selection +- Implementing barcode search functionality using different programming languages +- How to process and extract information from the search results +- Troubleshooting common issues with barcode searching + +## Further Practice + +To reinforce your learning, try these exercises: + +1. Create a document with multiple different barcode types and practice searching for each type +2. Implement a search that finds all barcodes and extracts their text into a report +3. Write a program that searches for barcodes in a batch of documents +4. Create a workflow that verifies if expected barcodes are present in a document + +## Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/signature/english/advanced-features/update-barcode-signatures/_index.md b/content/signature/english/advanced-features/update-barcode-signatures/_index.md new file mode 100644 index 0000000..04b549b --- /dev/null +++ b/content/signature/english/advanced-features/update-barcode-signatures/_index.md @@ -0,0 +1,521 @@ +--- +title: "Updating Barcode Signatures" +id: "tutorial-update-barcode-signatures" +url: /advanced-features/update-barcode-signatures/ +productName: "GroupDocs.Signature Cloud" +description: "Learn how to update barcode signatures in documents using GroupDocs.Signature Cloud API in this comprehensive step-by-step tutorial" +keywords: "update barcode tutorial, GroupDocs.Signature Cloud, modify barcode, document signatures tutorial, barcode API" +toc: true +--- + +# Tutorial: Updating Barcode Signatures + +## Introduction + +In this tutorial, you'll learn how to update existing barcode signatures in documents using GroupDocs.Signature Cloud API. The ability to modify barcode signatures after they've been placed in a document offers flexibility for adjusting position, size, and other properties without having to recreate the entire signature. + +**Learning Objectives:** +- Understand when and why to update barcode signatures +- Learn to search for existing barcode signatures to update +- Implement barcode signature updates in different programming languages +- Master various modification options for barcode signatures + +## Prerequisites + +Before you begin this tutorial, make sure you have: + +1. A [GroupDocs.Signature Cloud account](https://dashboard.groupdocs.cloud/#/apps) +2. Your Client ID and Client Secret credentials +3. Access to the [API Reference](https://reference.groupdocs.cloud/signature/) +4. Development environment with the necessary SDK installed +5. A document with existing barcode signatures that you want to update + +## Why Update Barcode Signatures? + +There are several scenarios where updating barcode signatures is valuable: + +- **Layout Adjustments**: Reposition barcodes for better document formatting +- **Visibility Improvements**: Modify the size or appearance of barcodes for better readability +- **Content Status Changes**: Mark or unmark barcodes as official signatures +- **Metadata Updates**: Change properties like signature ID or timestamp + +## Practical Scenario + +Let's consider a practical application: A shipping company has a document template with barcode signatures in suboptimal positions. They need to update these barcodes to be more prominent and repositioned to a standardized location to ensure consistent scanning across all documents. + +## Step-by-Step Implementation + +### Step 1: Upload a Document with Existing Barcode Signatures to Cloud Storage + +First, let's upload a document containing barcode signatures: + +```javascript +// First get JSON Web 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" + +// Upload document +curl -v "https://api.groupdocs.cloud/v2.0/signature/storage/file/signedBarcode_one-page.docx" \ +-X PUT \ +-H "Content-Type: application/octet-stream" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +--data-binary @/path/to/your/signedBarcode_one-page.docx +``` + +### Step 2: Search for Existing Barcode Signatures to Get Their IDs + +Before you can update a barcode signature, you need to know its unique ID. Let's search for barcode signatures in the document: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/search" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'signedBarcode_one-page.docx' + }, + 'Options': [ + { + 'AllPages': true, + 'SignatureType': 'Barcode' + } + ] +}" +``` + +From the search results, note the `signatureId` of the barcode signature you want to update. + +### Step 3: Configure Barcode Update Options + +Now, let's configure the update options, including the new position, size, and other properties: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/update" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { + 'FilePath': 'signedBarcode_one-page.docx' + }, + 'Options': [ + { + 'SignatureType': 'Barcode', + 'SignatureId': '4cb67aa8-835d-4877-8a5d-5a9ad015a098', + 'Left': 200, + 'Top': 200, + 'Width': 300, + 'Height': 100, + 'IsSignature': true + } + ] +}" +``` + +### Step 4: Process the Update Result + +The API will return information about the updated barcode signature: + +```javascript +{ + "fileInfo": { + "filePath": "signedBarcode_one-page.docx", + "storageName": null, + "versionId": null, + "password": null + }, + "size": 1360021, + "succeeded": [ + { + "barcodeType": "Code128", + "text": "123456789012", + "format": null, + "signatureType": "Barcode", + "pageNumber": 1, + "signatureId": "4cb67aa8-835d-4877-8a5d-5a9ad015a098", + "isSignature": true, + "createdOn": "2020-07-23T07:26:42.7549544+00:00", + "modifiedOn": "2020-07-23T07:36:03.9037414+00:00", + "top": 200, + "left": 200, + "width": 300, + "height": 100 + } + ], + "failed": [] +} +``` + +### Step 5: Download the Updated Document + +Once the document has been updated, you can download it: + +```javascript +curl -v "https://api.groupdocs.cloud/v2.0/signature/storage/file/signedBarcode_one-page.docx" \ +-X GET \ +-H "Accept: application/octet-stream" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +--output updated_signedBarcode_one-page.docx +``` + +## Try It Yourself + +Now that you understand the process, try implementing barcode updates with different settings: + +1. Change the position of the barcode to different coordinates +2. Adjust the size of the barcode to make it larger or smaller +3. Toggle the `IsSignature` property to change its status +4. Update multiple barcode signatures in a single request + +## SDK Examples + +### C# Example + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-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 SignApi(configuration); + +// Search for barcode signatures to get their IDs +var searchBarcodeOptions = new SearchBarcodeOptions +{ + SignatureType = SignatureTypeEnum.Barcode, + MatchType = SearchBarcodeOptions.MatchTypeEnum.Contains, + Text = "123456789012", + BarcodeType = "Code128", + AllPages = true +}; + +// Search settings. +var searchSettings = new SearchSettings +{ + FileInfo = new FileInfo + { + FilePath = "signedBarcode_one-page.docx", + }, + Options = new List { searchBarcodeOptions } +}; + +// Call search API to get signature IDs +var searchResult = apiInstance.SearchSignatures(new SearchSignaturesRequest(searchSettings)); + +// Check if any signatures were found +if (searchResult.Signatures != null && searchResult.Signatures.Count > 0) +{ + // Get the ID of the first signature found + string signatureId = searchResult.Signatures[0].SignatureId; + + // Configure update options + var updateOptions = new UpdateOptions + { + SignatureType = UpdateOptions.SignatureTypeEnum.Barcode, + SignatureId = signatureId, + // Set new position + Left = 200, + Top = 200, + // Set new size + Width = 300, + Height = 100, + // Mark as official signature + IsSignature = true + }; + + // Update settings + var updateSettings = new UpdateSettings + { + FileInfo = new FileInfo + { + FilePath = "signedBarcode_one-page.docx" + }, + Options = new List { updateOptions } + }; + + // Create update request + var request = new UpdateSignaturesRequest(updateSettings); + + // Call API to update the signature + var response = apiInstance.UpdateSignatures(request); + + // Process update result + if (response.Succeeded != null && response.Succeeded.Count > 0) + { + Console.WriteLine("Barcode signature was successfully updated!"); + Console.WriteLine($"New position: Left={response.Succeeded[0].Left}, Top={response.Succeeded[0].Top}"); + Console.WriteLine($"New size: Width={response.Succeeded[0].Width}, Height={response.Succeeded[0].Height}"); + Console.WriteLine($"Is signature: {response.Succeeded[0].IsSignature}"); + Console.WriteLine($"Modified on: {response.Succeeded[0].ModifiedOn}"); + } + else + { + Console.WriteLine("Failed to update barcode signature."); + } +} +else +{ + Console.WriteLine("No barcode signatures found in the document."); +} +``` + +### Java Example + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-java-samples +String MyClientSecret = "YOUR_CLIENT_SECRET"; +String MyClientId = "YOUR_CLIENT_ID"; + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); +SignApi apiInstance = new SignApi(configuration); + +FileInfo fileInfo = new FileInfo(); +fileInfo.setFilePath("signedBarcode_one-page.docx"); + +// Search for barcode signatures to get their IDs +SearchBarcodeOptions searchOptions = new SearchBarcodeOptions(); +searchOptions.setSignatureType(SignatureTypeEnum.BARCODE); +searchOptions.setAllPages(true); + +SearchSettings searchSettings = new SearchSettings(); +searchSettings.setFileInfo(fileInfo); +searchSettings.addOptionsItem(searchOptions); + +SearchSignaturesRequest searchRequest = new SearchSignaturesRequest(searchSettings); +SearchResult searchResult = apiInstance.searchSignatures(searchRequest); + +// Check if any signatures were found +if (searchResult.getSignatures() != null && !searchResult.getSignatures().isEmpty()) { + // Get the ID of the first signature found + String signatureId = searchResult.getSignatures().get(0).getSignatureId(); + + // Configure update options + UpdateOptions updateOptions = new UpdateOptions(); + updateOptions.setSignatureType(UpdateOptions.SignatureTypeEnum.BARCODE); + updateOptions.setSignatureId(signatureId); + + // Set new position + updateOptions.setLeft(200); + updateOptions.setTop(200); + + // Set new size + updateOptions.setWidth(300); + updateOptions.setHeight(100); + + // Mark as official signature + updateOptions.setIsSignature(true); + + // Update settings + UpdateSettings updateSettings = new UpdateSettings(); + updateSettings.setFileInfo(fileInfo); + updateSettings.addOptionsItem(updateOptions); + + // Create update request + UpdateSignaturesRequest updateRequest = new UpdateSignaturesRequest(updateSettings); + + // Call API to update the signature + UpdateResult updateResult = apiInstance.updateSignatures(updateRequest); + + // Process update result + if (updateResult.getSucceeded() != null && !updateResult.getSucceeded().isEmpty()) { + System.out.println("Barcode signature was successfully updated!"); + System.out.println("New position: Left=" + updateResult.getSucceeded().get(0).getLeft() + + ", Top=" + updateResult.getSucceeded().get(0).getTop()); + System.out.println("New size: Width=" + updateResult.getSucceeded().get(0).getWidth() + + ", Height=" + updateResult.getSucceeded().get(0).getHeight()); + System.out.println("Is signature: " + updateResult.getSucceeded().get(0).getIsSignature()); + System.out.println("Modified on: " + updateResult.getSucceeded().get(0).getModifiedOn()); + } else { + System.out.println("Failed to update barcode signature."); + } +} else { + System.out.println("No barcode signatures found in the document."); +} +``` + +### Python Example + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-signature-cloud/groupdocs-signature-cloud-python-samples +import groupdocs_signature_cloud + +# Get your app_sid and app_key at https://dashboard.groupdocs.cloud +client_id = "YOUR_CLIENT_ID" +client_secret = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = groupdocs_signature_cloud.SignApi.from_keys(client_id, client_secret) + +# Document information +file_info = groupdocs_signature_cloud.FileInfo() +file_info.file_path = "signedBarcode_one-page.docx" + +# Search for barcode signatures to get their IDs +search_opts = groupdocs_signature_cloud.SearchBarcodeOptions() +search_opts.signature_type = 'Barcode' +search_opts.all_pages = True + +search_settings = groupdocs_signature_cloud.SearchSettings() +search_settings.options = [search_opts] +search_settings.file_info = file_info + +search_request = groupdocs_signature_cloud.SearchSignaturesRequest(search_settings) +search_result = api.search_signatures(search_request) + +# Check if any signatures were found +if search_result.signatures and len(search_result.signatures) > 0: + # Get the ID of the first signature found + signature_id = search_result.signatures[0].signature_id + + # Configure update options + update_opts = groupdocs_signature_cloud.UpdateOptions() + update_opts.signature_type = 'Barcode' + update_opts.signature_id = signature_id + + # Set new position + update_opts.left = 200 + update_opts.top = 200 + + # Set new size + update_opts.width = 300 + update_opts.height = 100 + + # Mark as official signature + update_opts.is_signature = True + + # Update settings + update_settings = groupdocs_signature_cloud.UpdateSettings() + update_settings.options = [update_opts] + update_settings.file_info = file_info + + # Create update request + update_request = groupdocs_signature_cloud.UpdateSignaturesRequest(update_settings) + + # Call API to update the signature + update_result = api.update_signatures(update_request) + + # Process update result + if update_result.succeeded and len(update_result.succeeded) > 0: + print("Barcode signature was successfully updated!") + print(f"New position: Left={update_result.succeeded[0].left}, Top={update_result.succeeded[0].top}") + print(f"New size: Width={update_result.succeeded[0].width}, Height={update_result.succeeded[0].height}") + print(f"Is signature: {update_result.succeeded[0].is_signature}") + print(f"Modified on: {update_result.succeeded[0].modified_on}") + else: + print("Failed to update barcode signature.") +else: + print("No barcode signatures found in the document.") +``` + +## Advanced Update Options + +### Properties You Can Update + +GroupDocs.Signature Cloud allows you to update several properties of barcode signatures: + +1. **Position Properties**: + - `Left`: Horizontal position from the left edge of the page + - `Top`: Vertical position from the top edge of the page + +2. **Size Properties**: + - `Width`: Width of the barcode + - `Height`: Height of the barcode + +3. **Status Properties**: + - `IsSignature`: Boolean value indicating if the barcode should be considered an official signature + +4. **Appearance Properties** (some document formats only): + - `Border`: Border settings for the barcode + - `BackgroundColor`: Background color of the barcode + - `TransparencyLevel`: Transparency level of the barcode + +### Updating Multiple Signatures + +You can update multiple barcode signatures in a single request by adding multiple update options: + +```csharp +// First barcode update options +var updateOptions1 = new UpdateOptions +{ + SignatureType = UpdateOptions.SignatureTypeEnum.Barcode, + SignatureId = "signature-id-1", + Left = 200, + Top = 200 +}; + +// Second barcode update options +var updateOptions2 = new UpdateOptions +{ + SignatureType = UpdateOptions.SignatureTypeEnum.Barcode, + SignatureId = "signature-id-2", + Left = 300, + Top = 300 +}; + +// Add both to update settings +var updateSettings = new UpdateSettings +{ + FileInfo = new FileInfo { FilePath = "document.docx" }, + Options = new List { updateOptions1, updateOptions2 } +}; +``` + +## Limitations and Considerations + +When updating barcode signatures, be aware of these limitations: + +1. **Signature ID Required**: You must know the barcode's signature ID, which typically requires a search operation first +2. **Read-Only Properties**: Some properties like barcode type, text content, and decoding performance cannot be updated +3. **Document Format Support**: Not all document formats support all update operations equally +4. **Visibility Concerns**: Moving or resizing barcodes may impact their readability by barcode scanners + +## Troubleshooting + +### Common Issues + +**Issue**: "Signature not found" error despite using a valid signature ID. +**Solution**: Ensure the signature ID is correct and from the same document version. Signature IDs change when documents are modified. + +**Issue**: Updates don't apply as expected in certain document formats. +**Solution**: Some document formats have limitations on signature updates. Test with your specific document format. + +**Issue**: Barcode becomes unreadable after position/size updates. +**Solution**: Ensure the barcode maintains proper proportions after resizing. Avoid extreme distortion that might make the barcode unreadable. + +**Issue**: "Failed to update" error with no additional information. +**Solution**: Check if the document is password-protected or if the signature is in a protected area of the document. + +## What You've Learned + +In this tutorial, you've learned: +- How to search for and identify barcode signatures in documents +- Updating the position, size, and status of barcode signatures +- Implementing barcode updates in different programming languages (C#, Java, Python) +- Working with multiple barcode signatures in a single operation +- Understanding limitations and troubleshooting common issues + +## Further Practice + +To reinforce your learning, try these exercises: + +1. Create a document with multiple barcode signatures, then write code to standardize their positions +2. Implement a program that searches for barcodes and updates them based on their content +3. Create a workflow that checks if barcodes are positioned correctly and adjusts them if needed +4. Build a system that updates barcode signature statuses based on document processing stages + +## Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/signature/english/beginner-guide/_index.md b/content/signature/english/beginner-guide/_index.md new file mode 100644 index 0000000..53d5474 --- /dev/null +++ b/content/signature/english/beginner-guide/_index.md @@ -0,0 +1,46 @@ +--- +title: "GroupDocs.Signature Cloud API Document Beginner Guide Tutorials" +id: "beginner-guide-tutorials" +url: /beginner-guide/ +productName: "GroupDocs.Signature Cloud" +weight: 10 +description: "Learn step-by-step how to use GroupDocs.Signature Cloud API with these beginner tutorials for developers" +keywords: "groupdocs.signature cloud tutorial, document signature api tutorial, learn cloud document signature, beginner guide signature api" +toc: True +--- + +# GroupDocs.Signature Cloud API Beginner Guide Tutorials + +Welcome to our hands-on tutorial series for GroupDocs.Signature Cloud API! These step-by-step tutorials are designed specifically for developers who want to learn how to implement digital signature capabilities in their applications using our cloud-based API. + +## Learning Path + +This beginner guide follows a structured learning path, taking you from basic operations to more advanced signature functionality: + +1. **Getting Started** - Learn about supported formats and core capabilities +2. **Basic Document Operations** - Retrieve document information and create previews +3. **Working with Signature Types** - Explore barcode and QR code signatures + +Each tutorial includes complete code examples, explanations, and practical scenarios to help you implement these features in your own applications. + +## Available Tutorials + +### Getting Started + +- [Tutorial: Learn Supported File Formats](./file-formats/) - Learn how to query all document formats supported by the Signature Cloud API and incorporate format checking in your applications. + +### Basic Document Operations + +- [Tutorial: How to Get Document Information](./document-info/) - Follow this step-by-step guide to retrieve key document metadata including file format, page count, and document properties. + +## Additional Resources + +To support your learning journey, here are essential resources for GroupDocs.Signature Cloud: + +- [Product Page](https://products.groupdocs.cloud/signature/) - Explore features and benefits +- [Documentation](https://docs.groupdocs.cloud/signature/) - Comprehensive API documentation +- [Live Demo](https://products.groupdocs.app/signature/family) - Try the functionality without coding +- [API Reference](https://reference.groupdocs.cloud/signature/) - Detailed API specifications +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) - Latest updates and technical articles +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) - Get help from our community +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) - Start exploring the API today diff --git a/content/signature/english/beginner-guide/document-info/_index.md b/content/signature/english/beginner-guide/document-info/_index.md new file mode 100644 index 0000000..fe56d9e --- /dev/null +++ b/content/signature/english/beginner-guide/document-info/_index.md @@ -0,0 +1,341 @@ +--- +title: "Get Document Information with GroupDocs.Signature Cloud" +id: "get-document-information-tutorial" +url: /beginner-guide/document-info/ +productName: "GroupDocs.Signature Cloud" +weight: 2 +description: "Learn to retrieve essential document metadata and properties using GroupDocs.Signature Cloud API in this step-by-step tutorial for developers." +keywords: "signature cloud tutorial, document information API, get document metadata, file properties tutorial, learn GroupDocs API" +toc: True +--- + +# Tutorial: How to Get Document Information with GroupDocs.Signature Cloud + +## Learning Objectives + +In this tutorial, you'll learn: +- How to retrieve detailed information about documents before applying signatures +- How to extract metadata, page count, and document dimensions +- How to incorporate document information into your signature workflows + +## Prerequisites + +Before starting this tutorial, you should have: +- A GroupDocs.Signature Cloud account (if you don't have one, [sign up for a free trial](https://dashboard.groupdocs.cloud/#/apps)) +- Your document files uploaded to GroupDocs cloud storage or accessible via URL +- Basic REST API understanding +- Development environment set up for your chosen SDK + +## Why Document Information Matters + +Before applying digital signatures to a document, understanding its structure is crucial. The document information API helps you: + +- Determine how many pages are available for applying signatures +- Identify document dimensions to properly position signature elements +- Verify document format and properties before processing +- Plan signature placement based on page layout + +## Step 1: Setting Up Authentication + +All GroupDocs.Signature Cloud API calls require authentication using your client credentials. + +1. Retrieve your Client ID and Client Secret from [GroupDocs Dashboard](https://dashboard.groupdocs.cloud/#/apps) +2. Generate an access token using these credentials + +Here's how: + +```bash +# First get JSON Web 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" +``` + +## Step 2: Preparing Your Document + +Before retrieving document information, ensure your document is available either: +- Uploaded to your GroupDocs Cloud Storage, or +- Accessible via a public URL + +For this tutorial, we'll use a document already uploaded to cloud storage. + +## Step 3: Making the API Request + +To get document information, you'll make a POST request to the info endpoint: + +### cURL Example + +```bash +curl -X POST "https://api.groupdocs.cloud/v2.0/signature/info" \ +-H "accept: application/json" \ +-H "authorization: Bearer YOUR_ACCESS_TOKEN" \ +-H "Content-Type: application/json" \ +-d "{ \"FileInfo\": { \"FilePath\": \"documents/sample.docx\", \"StorageName\": \"MyStorage\", \"VersionId\": \"\", \"Password\": \"\" }}" +``` + +### Request Parameters Explained + +- **FilePath**: Path to your document in cloud storage +- **StorageName**: Name of the storage where your document is located +- **VersionId**: Optional parameter for versioned documents +- **Password**: Optional parameter for password-protected documents + +### Try It Yourself + +Replace the placeholder values with your actual document path and access token, then run the command. + +## Step 4: Understanding the Response + +The API returns a JSON object containing detailed document information: + +```json +{ + "fileName": "sample.docx", + "extension": ".docx", + "fileFormat": "Microsoft Words", + "size": 324608, + "dateModified": "2023-05-15T12:57:58.9646989Z", + "pages": { + "totalCount": 5, + "entries": [ + { + "number": 1, + "name": null, + "width": 816, + "height": 1056, + "angle": 0, + "visible": true, + "rows": null + }, + // Additional pages... + ] + } +} +``` + +Key information includes: +- **fileName**: The document's name +- **extension**: File extension +- **fileFormat**: Human-readable format description +- **size**: File size in bytes +- **dateModified**: Last modification date +- **pages**: Array of page information including dimensions and count + +## Step 5: Implementing in Your Application + +Now let's implement this functionality using various SDKs: + +### C# Example + +```csharp +// Get document information in C# +// Tutorial Code Example +using GroupDocs.Signature.Cloud.Sdk.Api; +using GroupDocs.Signature.Cloud.Sdk.Client; +using GroupDocs.Signature.Cloud.Sdk.Model; + +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); +var apiInstance = new InfoApi(configuration); + +// Document information request +var fileInfo = new FileInfo +{ + FilePath = "documents/sample.docx", + StorageName = "MyStorage", + // Password = "document_password" // Uncomment if document is password-protected +}; + +var request = new GetInfoRequest(fileInfo); +var response = apiInstance.GetInfo(request); + +// Display document information +Console.WriteLine($"File Name: {response.FileName}"); +Console.WriteLine($"File Format: {response.FileFormat}"); +Console.WriteLine($"Page Count: {response.Pages.TotalCount}"); + +// Process page dimensions for signature placement planning +foreach (var page in response.Pages.Entries) +{ + Console.WriteLine($"Page {page.Number}: Width = {page.Width}, Height = {page.Height}"); + + // Calculate potential signature zones (example) + var bottomRightZone = new + { + X = page.Width - 200, // 200 pixels from right edge + Y = page.Height - 100, // 100 pixels from bottom edge + Width = 180, + Height = 80 + }; + + Console.WriteLine($" Recommended signature zone: X={bottomRightZone.X}, Y={bottomRightZone.Y}, Width={bottomRightZone.Width}, Height={bottomRightZone.Height}"); +} +``` + +### Java Example + +```java +// Get document information in Java +// Tutorial Code Example +import com.groupdocs.signature.cloud.api.InfoApi; +import com.groupdocs.signature.cloud.client.Configuration; +import com.groupdocs.signature.cloud.model.FileInfo; +import com.groupdocs.signature.cloud.model.InfoResult; +import com.groupdocs.signature.cloud.model.PageInfo; + +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); +InfoApi apiInstance = new InfoApi(configuration); + +// Document information request +FileInfo fileInfo = new FileInfo(); +fileInfo.setFilePath("documents/sample.docx"); +fileInfo.setStorageName("MyStorage"); +// fileInfo.setPassword("document_password"); // Uncomment if document is password-protected + +InfoResult response = apiInstance.getInfo(fileInfo); + +// Display document information +System.out.println("File Name: " + response.getFileName()); +System.out.println("File Format: " + response.getFileFormat()); +System.out.println("Page Count: " + response.getPages().getTotalCount()); + +// Process page dimensions for signature placement planning +for (PageInfo page : response.getPages().getEntries()) { + System.out.println("Page " + page.getNumber() + ": Width = " + page.getWidth() + ", Height = " + page.getHeight()); + + // Calculate potential signature zones (example) + int x = page.getWidth() - 200; // 200 pixels from right edge + int y = page.getHeight() - 100; // 100 pixels from bottom edge + int width = 180; + int height = 80; + + System.out.println(" Recommended signature zone: X=" + x + ", Y=" + y + ", Width=" + width + ", Height=" + height); +} +``` + +### Python Example + +```python +# Get document information in Python +# Tutorial Code Example +from groupdocs_signature_cloud import * +import groupdocs_signature_cloud + +client_id = "YOUR_CLIENT_ID" # Get from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get from https://dashboard.groupdocs.cloud + +api = groupdocs_signature_cloud.InfoApi.from_keys(client_id, client_secret) + +# Document information request +file_info = groupdocs_signature_cloud.FileInfo() +file_info.file_path = "documents/sample.docx" +file_info.storage_name = "MyStorage" +# file_info.password = "document_password" # Uncomment if document is password-protected + +request = groupdocs_signature_cloud.GetInfoRequest(file_info) +response = api.get_info(request) + +# Display document information +print(f"File Name: {response.file_name}") +print(f"File Format: {response.file_format}") +print(f"Page Count: {response.pages.total_count}") + +# Process page dimensions for signature placement planning +for page in response.pages.entries: + print(f"Page {page.number}: Width = {page.width}, Height = {page.height}") + + # Calculate potential signature zones (example) + x = page.width - 200 # 200 pixels from right edge + y = page.height - 100 # 100 pixels from bottom edge + width = 180 + height = 80 + + print(f" Recommended signature zone: X={x}, Y={y}, Width={width}, Height={height}") +``` + +## Step 6: Using Document Information for Signature Placement + +Now that you have document information, let's use it for signature placement planning: + +```javascript +// Example signature positioning function +function calculateSignaturePosition(pageInfo, signatureType) { + let position = {x: 0, y: 0, width: 0, height: 0}; + + switch(signatureType) { + case 'digital': + // Bottom right corner for digital signatures + position.width = Math.min(200, pageInfo.width * 0.3); + position.height = Math.min(80, pageInfo.height * 0.1); + position.x = pageInfo.width - position.width - 20; + position.y = pageInfo.height - position.height - 20; + break; + + case 'barcode': + // Top right for barcodes + position.width = Math.min(150, pageInfo.width * 0.2); + position.height = Math.min(150, pageInfo.height * 0.15); + position.x = pageInfo.width - position.width - 20; + position.y = 20; + break; + + case 'qrcode': + // Bottom left for QR codes + position.width = Math.min(150, pageInfo.width * 0.2); + position.height = position.width; // Square + position.x = 20; + position.y = pageInfo.height - position.height - 20; + break; + + default: + // Default center position + position.width = Math.min(200, pageInfo.width * 0.3); + position.height = Math.min(80, pageInfo.height * 0.1); + position.x = (pageInfo.width - position.width) / 2; + position.y = (pageInfo.height - position.height) / 2; + } + + return position; +} +``` + +## Troubleshooting Tips + +Common issues you might encounter: + +- **"File not found" error**: Double-check your file path and storage name +- **Permission errors**: Ensure your access token has the right permissions +- **Format errors**: If getting incorrect page information, verify the file is not corrupted +- **Password issues**: For protected documents, ensure you're providing the correct password + +## What You've Learned + +In this tutorial, you've learned: +- How to retrieve detailed document information using GroupDocs.Signature Cloud API +- How to extract page dimensions, counts, and document metadata +- How to use document information for intelligent signature placement +- How to implement document information retrieval in different programming languages + +## Further Practice + +To reinforce your learning: +1. Create a function that calculates optimal signature positions based on document type +2. Build a document analyzer that recommends different signature types based on document structure +3. Implement document validation that checks if the document meets requirements for signing + +## Additional Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/signature/english/beginner-guide/file-formats/_index.md b/content/signature/english/beginner-guide/file-formats/_index.md new file mode 100644 index 0000000..876aaf2 --- /dev/null +++ b/content/signature/english/beginner-guide/file-formats/_index.md @@ -0,0 +1,260 @@ +--- +title: "Supported File Formats in GroupDocs.Signature Cloud" +id: "get-supported-file-formats-tutorial" +url: /beginner-guide/file-formats/ +productName: "GroupDocs.Signature Cloud" +weight: 1 +description: "This beginner tutorial teaches you how to retrieve all supported file formats in GroupDocs.Signature Cloud API to validate document compatibility." +keywords: "signature api tutorial, groupdocs.signature cloud formats, supported document formats tutorial, learn file format validation" +toc: True +--- + +# Tutorial: Learn Supported File Formats in GroupDocs.Signature Cloud + +## Learning Objectives + +In this tutorial, you'll learn: +- How to query all document formats supported by GroupDocs.Signature Cloud +- How to implement format validation in your applications +- How to interpret and use the format information returned by the API + +## Prerequisites + +Before starting this tutorial, you should have: +- A GroupDocs.Signature Cloud account (if you don't have one, [sign up for a free trial](https://dashboard.groupdocs.cloud/#/apps)) +- Basic understanding of REST APIs +- Familiarity with your programming language of choice (C#, Java, PHP, etc.) +- Development environment set up for your chosen SDK + +## Understanding File Format Support + +Before applying signatures to documents, it's essential to verify whether your document formats are supported by the API. GroupDocs.Signature Cloud supports a wide range of document formats including PDF, Microsoft Office documents, images, and more. + +### Why This Matters + +Checking for format support helps you: +- Validate user uploads before processing +- Provide clear feedback to users about acceptable formats +- Ensure compatibility with your signature workflows + +## Step 1: Setting Up Authentication + +All GroupDocs.Signature Cloud API calls require authentication using your client credentials. + +1. Obtain your Client ID and Client Secret from [GroupDocs Dashboard](https://dashboard.groupdocs.cloud/#/apps) +2. Use these credentials to authenticate your API requests + +Here's how to generate an access token: + +```bash +# First get JSON Web 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" +``` + +## Step 2: Making the API Request + +To get all supported file formats, you'll make a GET request to the formats endpoint: + +### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v2.0/signature/formats" \ +-H "accept: application/json" \ +-H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +### Try It Yourself + +Replace `YOUR_ACCESS_TOKEN` with the token you received in Step 1, then run the command in your terminal. You should receive a JSON response with all supported formats. + +## Step 3: Understanding the Response + +The API returns a JSON object containing an array of supported formats. Each format includes: +- **extension**: The file extension (e.g., ".pdf", ".docx") +- **fileFormat**: A human-readable format name (e.g., "Portable Document Format", "Microsoft Word") + +Here's a sample of what you'll see in the response: + +```json +{ + "formats": [ + { + "extension": ".pdf", + "fileFormat": "Portable Document Format" + }, + { + "extension": ".docx", + "fileFormat": "Microsoft Word" + }, + ... + ] +} +``` + +## Step 4: Implementing Format Validation + +Now let's implement this in your application using SDK examples: + +### C# Example + +```csharp +// Get supported file formats in C# +// Tutorial Code Example +string MyClientSecret = "YOUR_CLIENT_SECRET"; // Get from https://dashboard.groupdocs.cloud +string MyClientId = "YOUR_CLIENT_ID"; // Get from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); +var apiInstance = new InfoApi(configuration); + +var response = apiInstance.GetSupportedFileFormats(); +foreach (var format in response.Formats) +{ + Console.WriteLine($"Extension: {format.Extension}, Format: {format.FileFormat}"); +} + +// Example of validation function: +bool IsFormatSupported(string fileExtension, IEnumerable supportedFormats) +{ + // Ensure extension starts with a dot + if (!fileExtension.StartsWith(".")) + fileExtension = "." + fileExtension; + + return supportedFormats.Any(format => format.Extension.Equals(fileExtension, StringComparison.OrdinalIgnoreCase)); +} +``` + +### Java Example + +```java +// Get supported file formats in Java +// Tutorial Code Example +String MyClientSecret = "YOUR_CLIENT_SECRET"; // Get from https://dashboard.groupdocs.cloud +String MyClientId = "YOUR_CLIENT_ID"; // Get from https://dashboard.groupdocs.cloud + +Configuration configuration = new Configuration(MyClientId, MyClientSecret); +InfoApi apiInstance = new InfoApi(configuration); + +FormatsResult response = apiInstance.getSupportedFileFormats(); +for (FileFormat format : response.getFormats()) { + System.out.println("Extension: " + format.getExtension() + ", Format: " + format.getFileFormat()); +} + +// Example of validation method: +public boolean isFormatSupported(String fileExtension, List supportedFormats) { + // Ensure extension starts with a dot + if (!fileExtension.startsWith(".")) + fileExtension = "." + fileExtension; + + for (FileFormat format : supportedFormats) { + if (format.getExtension().equalsIgnoreCase(fileExtension)) { + return true; + } + } + return false; +} +``` + +### Python Example + +```python +# Get supported file formats in Python +# Tutorial Code Example +from groupdocs_signature_cloud import * +import groupdocs_signature_cloud + +client_id = "YOUR_CLIENT_ID" # Get from https://dashboard.groupdocs.cloud +client_secret = "YOUR_CLIENT_SECRET" # Get from https://dashboard.groupdocs.cloud + +api = groupdocs_signature_cloud.InfoApi.from_keys(client_id, client_secret) + +response = api.get_supported_file_formats() +for format in response.formats: + print(f"Extension: {format.extension}, Format: {format.file_format}") + +# Example of validation function: +def is_format_supported(file_extension, supported_formats): + # Ensure extension starts with a dot + if not file_extension.startswith("."): + file_extension = "." + file_extension + + return any(format.extension.lower() == file_extension.lower() for format in supported_formats) +``` + +## Step 5: Implementing a Format Checker in Your Application + +Now, let's create a practical example of a format checker for file uploads: + +```javascript +// Example JavaScript frontend code for format validation +async function validateFileFormat(file) { + try { + // Call your backend which accesses the GroupDocs API + const response = await fetch('/api/supported-formats'); + const data = await response.json(); + + // Extract file extension from filename + const extension = '.' + file.name.split('.').pop().toLowerCase(); + + // Check if extension is in supported formats + const isSupported = data.formats.some(format => + format.extension.toLowerCase() === extension + ); + + if (isSupported) { + return { valid: true, message: "File format is supported" }; + } else { + return { + valid: false, + message: `Format ${extension} is not supported. Please upload one of: ${getSupportedExtensionsList(data.formats)}` + }; + } + } catch (error) { + console.error("Error validating format:", error); + return { valid: false, message: "Error checking format support" }; + } +} + +function getSupportedExtensionsList(formats) { + // Return the first 5 common formats for display + return formats + .slice(0, 5) + .map(format => format.extension) + .join(', ') + '...'; +} +``` + +## Troubleshooting Tips + +Common issues you might encounter: + +- **Authentication errors**: Ensure your access token is valid and not expired +- **Empty formats list**: Check your API connection and ensure your account has proper access +- **Case sensitivity**: Remember that file extensions should be compared case-insensitively + +## What You've Learned + +In this tutorial, you've learned: +- How to retrieve all document formats supported by GroupDocs.Signature Cloud +- How to implement format validation in different programming languages +- How to create a practical file format validator for user uploads + +## Further Practice + +To reinforce your learning: +1. Implement a file format filter for a file upload component +2. Create a helper function that groups formats by category (e.g., Microsoft Office, Images) +3. Build a user-friendly error message system that suggests alternative formats + +## Additional Resources + +- [Product Page](https://products.groupdocs.cloud/signature/) +- [Documentation](https://docs.groupdocs.cloud/signature/) +- [Live Demo](https://products.groupdocs.app/signature/family) +- [API Reference](https://reference.groupdocs.cloud/signature/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.signature-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/signature/13/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps)