Convert N Consecutive Pages

This example demonstrates how to convert consecutive pages from word processing documents into pdf documents.

There are steps that usage of GroupDocs.Conversion Cloud consists of:

  1. Upload input document into cloud storage
  2. Convert document
  3. Download converted document from storage

Steps 1 and 3 are storage operations, please refer to this for usage details. Step 3 is not needed if the “OutputPath” option is not provided: the convert API method will return the converted document in the response body.

NameDescriptionComment
FileInfo.FilePathThe path of the document, located in the storage.Required.
FileInfo.StorageNameStorage nameIt could be omitted for default storage.
FileInfo.PasswordThe password to open fileIt should be specified only for password-protected documents.

Resource URI

HTTP POST ~/conversion

Swagger UI lets you call this REST API directly from the browser.

cURL example

# First get JSON Web Token
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "https://api.groupdocs.cloud/connect/token" \
-X POST \
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

# cURL example to convert document
curl -v "https://api.groupdocs.cloud/v2.0/conversion/conversion" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer <jwt token>"
-d "{
        'FilePath': 'WordProcessing/four-pages.docx',
        'Format': 'pdf',
        'ConvertOptions': {
            'FromPage': 2,
            'PagesCount': 2
        },
        'OutputPath': 'Output/two-pages.pdf'
    }"
[
  {
    "name": "two-pages.pdf",
    "size": 76532,
    "path": "Output/two-pages.pdf",
    "url": "https://api-qa.groupdocs.cloud/v2.0/conversion/storage/file/Output/two-pages.pdf"
  }
]

SDK examples

Our API is completely independent of your operating system, database system or development language. You can use any language and platform that supports HTTP to interact with our API. However, manually writing client code can be difficult, error-prone and time-consuming. Therefore, we have provided and support API SDKs in many development languages in order to make it easier to integrate with us.