Split Document

Split the Document Into Several One-Page Documents

GroupDocs.Merger Cloud REST API provides an ability to split the document into several one-page documents by providing exact page numbers. The following example demonstrates how to split the document into three one-page documents with 3rd, 6th, and 8th pages. As a result, these documents will be produced:

Document namePage numbers
document_03
document_16
document_28

Resource URI


HTTP POST ~/join

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 join several documents into one
curl -v "https://api.groupdocs.cloud/v1.0/merger/join" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer
<jwt token>"
-d "{
    'JoinItems':
    [
        {
            'FileInfo':
            {
                'FilePath': '/WordProcessing/four-pages.docx',
                'Password': 'password'
            }
        },
        {
            'FileInfo':
            {
                'FilePath': '/WordProcessing/one-page.docx'
            }
        }
    ],
    'OutputPath': 'output/joined.docx'
}"

* Response will contain storage path to resultant document
{
  "path": "Output/joined.docx"
}

SDK examples

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of makingRequests and handlingResponses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Merger Cloud SDKs along with working examples, to get you started in no time. Please check the article to learn how to add an SDK to your project.

Split the Document Into Several One-Page Documents by Providing Exact Page Numbers

GroupDocs.Merger Cloud REST API provides an ability to split the document into several one-page documents by specifying only start/end page numbers. The following example demonstrates how to split the document into several one-page documents starting from 3rd and ending at 7th-page number. As a result, these documents will be produced:

Document namePage numbers
document_03
document_14
document_25
document_36
document_47

Resource URI


HTTP POST ~/join

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

cURL example


*Response will contain storage path to resultant documents
{
  "documents": [
    {
      "path": "output/split-by-start-end-numbers\sample-10-pages_0.docx"
    },
    {
      "path": "output/split-by-start-end-numbers\sample-10-pages_1.docx"
    },
    {
      "path": "output/split-by-start-end-numbers\sample-10-pages_2.docx"
    },
    {
      "path": "output/split-by-start-end-numbers\sample-10-pages_3.docx"
    },
    {
      "path": "output/split-by-start-end-numbers\sample-10-pages_4.docx"
    }
  ]
}
*Response will contain storage path to resultant document
{
  "path": "Output/joined.docx"
}

SDK examples

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of makingRequests and handlingResponses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Merger Cloud SDKs along with working examples, to get you started in no time. Please check article to learn how to add an SDK to your project.

Split the Document Into Several One-Page Documents by Applying Filter

GroupDocs.Merger Cloud REST API provides an ability to filter even/odd pages while splitting the document into several one-page documents by specifying only start/end page numbers The following example demonstrates how to document several one-page documents for odd pages starting from 3rd and ending at 7th-page number. As a result, these documents will be produced:

Document name
Page numbers
document_0
document_1
document_2

Resource URI


HTTP POST ~/join

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 join pages from several documents into one document
curl -v "https://api.groupdocs.cloud/v1.0/merger/split" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer
<jwt token>"
-d "{
   'FileInfo': { 'FilePath': 'WordProcessing/sample-10-pages.docx' },
   'StartPageNumber':  3,
   'EndPageNumber' : 7,
   'RangeMode' : 1,
      'Mode': 'Pages',
      'OutputPath': 'output/split-by-start-end-numbers-with-filter'
 }"

*Response will contain storage path to resultant documents
{
  "documents": [
    {
      "path": "output/split-by-start-end-numbers-with-filter\sample-10-pages_0.docx"
    },
    {
      "path": "output/split-by-start-end-numbers-with-filter\sample-10-pages_1.docx"
    },
    {
      "path": "output/split-by-start-end-numbers-with-filter\sample-10-pages_2.docx"
    }
  ]
}

SDK examples

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of makingRequests and handlingResponses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Merger Cloud SDKs along with working examples, to get you started in no time. Please check the article to learn how to add an SDK to your project.

Split the Document to Several Multi-Page Documents

GroupDocs.Merger Cloud REST API provides an ability to split the document into several one-page documents by providing exact page numbers. The following example demonstrates how to split the document into three one-page documents with 3rd, 6th, and 8th pages. As a result, these documents will be produced:

Document namePage numbers
document_01, 2
document_13, 4, 5
document_26, 7
document_38, 9, 10

Resource URI


HTTP POST ~/join

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 join pages from several documents into one document
curl -v "https://api.groupdocs.cloud/v1.0/merger/split" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer
<jwt token>"
-d "{
   'FileInfo': { 'FilePath': 'WordProcessing/sample-10-pages.docx' },
    'Pages': [ 3, 6, 8 ],
    'Mode': 1,
    'OutputPath': '/output/split-to-multipage-document'
 }"

*Response will contain storage path to resultant documents

{
  "documents": [
    {
      "path": "output/split-to-multipage-document\sample-10-pages_0.docx"
    },
    {
      "path": "output/split-to-multipage-document\sample-10-pages_1.docx"
    },
    {
      "path": "output/split-to-multipage-document\sample-10-pages_2.docx"
    },
 {
      "path": "output/split-to-multipage-document\sample-10-pages_3.docx"
    }
  ]
}

SDK examples

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of makingRequests and handlingResponses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Merger Cloud SDKs along with working examples, to get you started in no time. Please check  article to learn how to add an SDK to your project.