Convert N Consecutive Pages
Introduction
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:
- Upload input document into cloud storage
- Convert document
- 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.
Name | Description | Comment |
---|---|---|
FileInfo.FilePath | The path of the document, located in the storage. | Required. |
FileInfo.StorageName | Storage name | It could be omitted for default storage. |
FileInfo.Password | The password to open file | It 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"
}
]
SDKs
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.