This REST API allows mixing specific pages from several source documents into a single resultant document. You can specify the exact order and selection of pages from each document, enabling advanced document composition scenarios.
To mix pages, provide:
A list of source documents (Files collection).
A list of page selections (FilesPages collection), where each item specifies which pages to take from which document and in what order.
The output path for the resultant document.
For password-protected documents, supply the password in the FileInfo object.
The table below describes the main properties for the Mix operation:
Name
Description
Comment
Files
List of files to mix
Required
FilesPages
List of page selections, each with file index and page numbers
Required
OutputPath
Path to resultant document
Required
WordJoinMode
Join mode for Word documents
Optional, default is Default
WordJoinCompliance
Compliance mode for Word OOXML format
Optional, default is Auto
ImageJoinMode
Join mode for images
Optional
Resource URI
HTTP POST ~/mix
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.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 mix pages from several documents into one documentcurl -v "https://api.groupdocs.cloud/v1.0/merger/mix"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer <jwt token>"\
-d "{
'Files': [
{ 'FilePath': 'WordProcessing/sample-10-pages.docx' },
{ 'FilePath': 'WordProcessing/four-pages.docx' }
],
'FilesPages': [
{ 'FileIndex': 0, 'Pages': [1, 2] },
{ 'FileIndex': 1, 'Pages': [1, 2] },
{ 'FileIndex': 0, 'Pages': [3, 4] }
],
'OutputPath': 'Output/mixed-pages.docx'
}"
{"path":"Output/mixed-pages.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 making requests and handling responses 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.
usingGroupDocs.Merger.Cloud.Sdk.Api;usingGroupDocs.Merger.Cloud.Sdk.Client;usingGroupDocs.Merger.Cloud.Sdk.Model;usingGroupDocs.Merger.Cloud.Sdk.Model.Requests;usingSystem;usingSystem.Collections.Generic;usingFileInfo=GroupDocs.Merger.Cloud.Sdk.Model.FileInfo;namespaceGroupDocs.Merger.Cloud.Examples.CSharp{/// <summary>/// This example demonstrates how to mix specific pages from several source documents./// </summary>publicclassMixPages{publicstaticvoidRun(){varconfiguration=Common.GetConfig();varapiInstance=newDocumentApi(configuration);varoptions=newMixPagesOptions{Files=newList<FileInfo>{new(){FilePath="WordProcessing/sample-10-pages.docx"},new(){FilePath="WordProcessing/four-pages.docx"}},FilesPages=newList<MixPagesItem>{new(){FileIndex=0,Pages=newList<int?>{1,2}},new(){FileIndex=1,Pages=newList<int?>{1,2}},new(){FileIndex=0,Pages=newList<int?>{3,4}},},OutputPath="Output/mixed-pages.docx"};varrequest=newMixRequest(options);varresponse=apiInstance.Mix(request);Console.WriteLine("Output file path: "+response.Path);}}}
packageexamples.DocumentOperations;importjava.util.Arrays;importcom.groupdocs.cloud.merger.client.*;importcom.groupdocs.cloud.merger.model.*;importcom.groupdocs.cloud.merger.model.requests.*;importcom.groupdocs.cloud.merger.api.*;importexamples.Utils;/**
* This example demonstrates how to mix specific pages from several source documents.
*/publicclassMerger_Java_MixPages{publicstaticvoidmain(String[]args){DocumentApiapiInstance=newDocumentApi(Utils.GetConfiguration());MixPagesOptionsoptions=newMixPagesOptions();options.setFiles(Arrays.asList(newFileInfo().setFilePath("WordProcessing/sample-10-pages.docx"),newFileInfo().setFilePath("WordProcessing/four-pages.docx")));options.setFilesPages(Arrays.asList(newMixPagesItem().setFileIndex(0).setPages(Arrays.asList(1,2)),newMixPagesItem().setFileIndex(1).setPages(Arrays.asList(1,2)),newMixPagesItem().setFileIndex(0).setPages(Arrays.asList(3,4))));options.setOutputPath("Output/mixed-pages.docx");MixRequestrequest=newMixRequest(options);DocumentResultresponse=apiInstance.mix(request);System.out.println("Output file path: "+response.getPath());}}
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-php-samples
$AppSid='XXXX-XXXX-XXXX-XXXX';// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$AppKey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Merger\Configuration();$configuration->setAppSid(CommonUtils::$AppSid);$configuration->setAppKey(CommonUtils::$AppKey);$documentApi=newGroupDocs\Merger\DocumentApi($configuration);$fileInfo1=newModel\FileInfo();$fileInfo1->setFilePath("WordProcessing/sample-10-pages.docx");$fileInfo2=newModel\FileInfo();$fileInfo2->setFilePath("WordProcessing/four-pages.docx");$item1=newModel\MixPagesItem();$item1->setFileIndex(0);$item1->setPages([1,2]);$item2=newModel\MixPagesItem();$item2->setFileIndex(1);$item2->setPages([1,2]);$item3=newModel\MixPagesItem();$item3->setFileIndex(0);$item3->setPages([3,4]);$options=newModel\MixPagesOptions();$options->setFiles([$fileInfo1,$fileInfo2]);$options->setFilesPages([$item1,$item2,$item3]);$options->setOutputPath("Output/mixed-pages.docx");$request=newRequests\MixRequest($options);$response=$documentApi->mix($request);
# For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-ruby-samples$app_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloud$app_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.clouddocumentApi=GroupDocsMergerCloud::DocumentApi.from_keys($app_sid,$app_key)file1=GroupDocsMergerCloud::FileInfo.newfile1.file_path='WordProcessing/sample-10-pages.docx'file2=GroupDocsMergerCloud::FileInfo.newfile2.file_path='WordProcessing/four-pages.docx'item1=GroupDocsMergerCloud::MixPagesItem.newitem1.file_index=0item1.pages=[1,2]item2=GroupDocsMergerCloud::MixPagesItem.newitem2.file_index=1item2.pages=[1,2]item3=GroupDocsMergerCloud::MixPagesItem.newitem3.file_index=0item3.pages=[3,4]options=GroupDocsMergerCloud::MixPagesOptions.newoptions.files=[file1,file2]options.files_pages=[item1,item2,item3]options.output_path="Output/mixed-pages.docx"result=documentApi.mix(GroupDocsMergerCloud::MixRequest.new(options))
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-node-samples
global.appSid="XXXX-XXXX-XXXX-XXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.appKey="XXXXXXXXXXXXXXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.documentApi=merger_cloud.DocumentApi.fromKeys(appSid,appKey);letfile1=newmerger_cloud.FileInfo();file1.filePath="WordProcessing/sample-10-pages.docx";letfile2=newmerger_cloud.FileInfo();file2.filePath="WordProcessing/four-pages.docx";letitem1=newmerger_cloud.MixPagesItem();item1.fileIndex=0;item1.pages=[1,2];letitem2=newmerger_cloud.MixPagesItem();item2.fileIndex=1;item2.pages=[1,2];letitem3=newmerger_cloud.MixPagesItem();item3.fileIndex=0;item3.pages=[3,4];letoptions=newmerger_cloud.MixPagesOptions();options.files=[file1,file2];options.filesPages=[item1,item2,item3];options.outputPath="Output/mixed-pages.docx";letresult=awaitdocumentApi.mix(newmerger_cloud.MixRequest(options));
# For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-python-samplesapp_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloudapp_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.clouddocumentApi=groupdocs_merger_cloud.DocumentApi.from_keys(app_sid,app_key)file1=groupdocs_merger_cloud.FileInfo("WordProcessing/sample-10-pages.docx")file2=groupdocs_merger_cloud.FileInfo("WordProcessing/four-pages.docx")item1=groupdocs_merger_cloud.MixPagesItem()item1.file_index=0item1.pages=[1,2]item2=groupdocs_merger_cloud.MixPagesItem()item2.file_index=1item2.pages=[1,2]item3=groupdocs_merger_cloud.MixPagesItem()item3.file_index=0item3.pages=[3,4]options=groupdocs_merger_cloud.MixPagesOptions()options.files=[file1,file2]options.files_pages=[item1,item2,item3]options.output_path="Output/mixed-pages.docx"result=documentApi.mix(groupdocs_merger_cloud.MixRequest(options))
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.