Cloud REST API for developers to quickly combine or split multiple documents of the same format within PHP based applications.
Start Free TrialGroupDocs.Merger Cloud SDK for PHP is a programmatic solution to seamlessly join multiple documents of the same format into one, allowing to combine them page by page or choosing between the page ranges. The Cloud SDK supports many useful document operations to split one document into many, and create image representation of document pages in PNG, JPG and BMP formats for the better diagnosis of document structure and content within it. The document merger SDK is also capable to perform many useful merging and splitting operations on documents pages thus allowing you to move, remove, rotate, swap, extract or change the orientation of the pages with additional support of document information extraction and management of password-protected documents. GroupDocs.Merger Cloud SDK for PHP is built as a layer on top of GroupDocs.Merger Cloud REST API that can be used with any language or development platform that can call REST APIs.
//Get your App SID and App Key at https://dashboard.groupdocs.cloud (free registration is required).
class JoinMultipleDocuments {
public static function Run() {
$documentApi = CommonUtils::GetDocumentApiInstance();
$fileInfo1 = new Model\FileInfo();
$fileInfo1->setFilePath("WordProcessing/four-pages.docx");
$item1 = new Model\JoinItem();
$item1->setFileInfo($fileInfo1);
$fileInfo2 = new Model\FileInfo();
$fileInfo2->setFilePath("WordProcessing/one-page.docx");
$item2 = new Model\JoinItem();
$item2->setFileInfo($fileInfo2);
$options = new Model\JoinOptions();
$options->setJoinItems([$item1, $item2]);
$options->setOutputPath("Output/joined.docx");
$request = new Requests\joinRequest($options);
$response = $documentApi->join($request);
echo "Output file path: " . $response->getPath();
echo "\n";
}
}
```