This REST API allows merging the document of different formats into one pdf or word processing document.
The table below contains the full list of properties that can be specified for each joined document.
Name
Description
Comment
FilePath
The file path in the storage
Required property
StorageName
Storage name
Could be omitted for default storage
VersionId
File version Id
Useful for storages that support file versioning
Password
The password to open file
Should be specified only for password-protected documents
Pages
Collection of page numbers to use in a Join operation
The first page should have number 1
StartPageNumber
Start page number
Ignored if Pages collection is not empty
EndPageNumber
End page number
Ignored if Pages collection is not empty
RangeMode
Page range mode: Even, Odd, All. The default value is All
Ignored if Pages collection is not empty
OutputPath
Path to resultant document
Required
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/join"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer
<jwt token>"-d "{
'JoinItems':
[
{
'FileInfo':
{
'FilePath': 'Pdf/one-page-password.pdf',
'Password': 'password'
}
},
{
'FileInfo':
{
'FilePath': 'WordProcessing/one-page.docx'
}
}
],
'OutputPath': 'Output/joined.pdf'
}"
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.
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-dotnet-samplesstringMyClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudstringMyClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyClientId,MyClientSecret);varapiInstance=newDocumentApi(configuration);try{varitem1=newJoinItem{FileInfo=newFileInfo{FilePath="Pdf/one-page-password.pdf",Password="password"}};varitem2=newJoinItem{FileInfo=newFileInfo{FilePath="WordProcessing/one-page.docx"}};varoptions=newJoinOptions{JoinItems=newList<JoinItem>{item1,item2},OutputPath="Output/joined.pdf"};varrequest=newJoinRequest(options);varresponse=apiInstance.Join(request);Console.WriteLine("Output file path: "+response.Path);}catch(Exceptione){Console.WriteLine("Exception while calling api: "+e.Message);}
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-java-samples
StringMyClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
StringMyClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyClientId,MyClientSecret);DocumentApiapiInstance=newDocumentApi(configuration);try{FileInfofileInfo1=newFileInfo();fileInfo1.setFilePath("Pdf/one-page-password.pdf");fileInfo1.setPassword("password");JoinItemitem1=newJoinItem();item1.setFileInfo(fileInfo1);FileInfofileInfo2=newFileInfo();fileInfo2.setFilePath("WordProcessing/one-page.docx");JoinItemitem2=newJoinItem();item2.setFileInfo(fileInfo2);JoinOptionsoptions=newJoinOptions();options.setJoinItems(Arrays.asList(item1,item2));options.setOutputPath("output/joined.pdf");JoinRequestrequest=newJoinRequest(options);DocumentResultresponse=apiInstance.join(request);System.err.println("Output file path: "+response.getPath());}catch(ApiExceptione){System.err.println("Exception while calling api:");e.printStackTrace();}
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-php-samples
useGroupDocs\Merger\Model;useGroupDocs\Merger\Model\Requests;$ClientId="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$ClientSecret="";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Merger\Configuration();$configuration->setAppSid($ClientId);$configuration->setAppKey($ClientSecret);$documentApi=newGroupDocs\Merger\DocumentApi($configuration);$fileInfo1=newModel\FileInfo();$fileInfo1->setFilePath("Pdf/one-page-password.pdf");$fileInfo1->setPassword("password");$item1=newModel\JoinItem();$item1->setFileInfo($fileInfo1);$fileInfo2=newModel\FileInfo();$fileInfo2->setFilePath("WordProcessing/one-page.docx");$item2=newModel\JoinItem();$item2->setFileInfo($fileInfo2);$options=newModel\JoinOptions();$options->setJoinItems([$item1,$item2]);$options->setOutputPath("Output/joined.pdf");$request=newRequests\joinRequest($options);$response=$documentApi->join($request);echo"Output file path: ".$response->getPath();echo"\n";
// For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-node-samples
global.merger_cloud=require("groupdocs-merger-cloud");global.clientId="XXXX-XXXX-XXXX-XXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
global.clientSecret="XXXXXXXXXXXXXXXX";// Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
global.documentApi=merger_cloud.DocumentApi.fromKeys(clientId,clientSecret);letitem1=newmerger_cloud.JoinItem();item1.fileInfo=newmerger_cloud.FileInfo();item1.fileInfo.filePath="Pdf/one-page-password.pdf";item1.fileInfo.password="password";letitem2=newmerger_cloud.JoinItem();item2.fileInfo=newmerger_cloud.FileInfo();item2.fileInfo.filePath="WordProcessing/one-page.docx";letoptions=newmerger_cloud.JoinOptions();options.joinItems=[item1,item2];options.outputPath="Output/joined.pdf";letresult=awaitdocumentApi.join(newmerger_cloud.JoinRequest(options));console.log("Output file path: "+result.path);
# For complete examples and data files, please go to https://github.com/groupdocs-merger_cloud-cloud/groupdocs-merger_cloud-cloud-python-samplesfromgroupdocs_merger_cloudimport*importgroupdocs_merger_cloudclient_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloudclient_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.clouddocumentApi=groupdocs_merger_cloud.DocumentApi.from_keys(client_id,client_secret)item1=groupdocs_merger_cloud.JoinItem()item1.file_info=groupdocs_merger_cloud.FileInfo("Pdf/one-page-password.pdf",None,None,"password")item2=groupdocs_merger_cloud.JoinItem()item2.file_info=groupdocs_merger_cloud.FileInfo("WordProcessing/one-page.docx")options=groupdocs_merger_cloud.JoinOptions()options.join_items=[item1,item2]options.output_path="Output/joined.pdf"result=documentApi.join(groupdocs_merger_cloud.JoinRequest(options))print("Output file path = "+result.path)
# For complete examples and data files, please go to https://github.com/groupdocs-merger-cloud/groupdocs-merger-cloud-ruby-samplesrequire'groupdocs_merger_cloud'$client_id="XXXX-XXXX-XXXX-XXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud$client_secret="XXXXXXXXXXXXXXXX"# Get ClientId and ClientSecret from https://dashboard.groupdocs.clouddocumentApi=GroupDocsMergerCloud::DocumentApi.from_keys($client_id,$client_secret)item1=GroupDocsMergerCloud::JoinItem.newitem1.file_info=GroupDocsMergerCloud::FileInfo.newitem1.file_info.file_path='Pdf/one-page-password.pdf'item1.file_info.password='password'item2=GroupDocsMergerCloud::JoinItem.newitem2.file_info=GroupDocsMergerCloud::FileInfo.newitem2.file_info.file_path='WordProcessing/one-page.docx'options=GroupDocsMergerCloud::JoinOptions.newoptions.join_items=[item1,item2]options.output_path="Output/joined.pdf"result=documentApi.join(GroupDocsMergerCloud::JoinRequest.new(options))puts("Output file path: "+result.path)
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.