Last active
January 22, 2020 17:53
-
-
Save groupdocscloud/48648ca8f7d3bfedb079a7d7e3af9e0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merger-Php-v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$securityApi = GroupDocs\Merger\SecurityApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/one-page.docx"); | |
$fileInfo->setPassword("Password"); | |
$options = new Model\Options(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/add-password.docx"); | |
$request = new Requests\addPasswordRequest($options); | |
$response = $securityApi->addPassword($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/four-pages.docx"); | |
$options = new Model\OrientationOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/change-page-orientation.docx"); | |
$options->setPages([2, 4]); | |
$options->setMode(Model\OrientationOptions::MODE_LANDSCAPE); | |
$request = new Requests\orientationRequest($options); | |
$response = $pagesApi->orientation($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$securityApi = GroupDocs\Merger\SecurityApi($configuration); | |
$request = new Requests\checkPasswordRequest("WordProcessing/password-protected.docx"); | |
$response = $securityApi->checkPassword($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFileApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\CopyFileRequest("mergerdocs\one-page.docx", "mergerdocs\one-page-copied.docx", CommonUtils::$MyStorage, CommonUtils::$MyStorage); | |
$apiInstance->copyFile($request); | |
echo "Expected response type is Void: 'mergerdocs/one-page.docx' file copied as 'mergerdocs/one-page-copied.docx'."; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFolderApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\CopyFolderRequest("mergerdocs", "mergerdocs1", CommonUtils::$MyStorage, CommonUtils::$MyStorage); | |
$apiInstance->copyFolder($request); | |
echo "Expected response type is Void: 'mergerdocs' folder copied as 'mergerdocs1'.", "<br />"; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFolderApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\CreateFolderRequest("mergerdocs", CommonUtils::$MyStorage); | |
$apiInstance->createFolder($request); | |
echo "Expected response type is Void: 'mergerdocs' folder created.", "<br />"; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFileApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\DeleteFileRequest("mergerdocs\one-page-copied.docx", CommonUtils::$MyStorage); | |
$apiInstance->deleteFile($request); | |
echo "Expected response type is Void: 'mergerdocs1/one-page-copied.docx' file deleted."; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFolderApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\DeleteFolderRequest("mergerdocs1\\mergerdocs1", CommonUtils::$MyStorage, true); | |
$apiInstance->deleteFolder($request); | |
echo "Expected response type is Void: 'mergerdocs1/mergerdocs1' folder deleted recursively.", "<br />"; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFileApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\DownloadFileRequest("mergerdocs\one-page.docx", CommonUtils::$MyStorage, null); | |
$response = $apiInstance->downloadFile($request); | |
echo "Expected response type is File: ", strlen($response); | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\ExtractOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/extract-pages-by-numbers.docx"); | |
$options->setPages([2, 4, 7]); | |
$request = new Requests\extractRequest($options); | |
$response = $pagesApi->extract($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\ExtractOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/extract-pages-by-range.docx"); | |
$options->setStartPageNumber(1); | |
$options->setEndPageNumber(10); | |
$options->setRangeMode(Model\ExtractOptions::RANGE_MODE_EVEN_PAGES); | |
$request = new Requests\extractRequest($options); | |
$response = $pagesApi->extract($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetStorageApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\GetDiscUsageRequest(CommonUtils::$MyStorage); | |
$response = $apiInstance->getDiscUsage($request); | |
echo "Expected response type is DiscUsage: ", $response; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetStorageApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\GetFileVersionsRequest("mergerdocs\one-page.docx", CommonUtils::$MyStorage); | |
$response = $apiInstance->getFileVersions($request); | |
echo "Expected response type is FileVersions: ", $response; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFolderApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\GetFilesListRequest("mergerdocs", CommonUtils::$MyStorage); | |
$response = $apiInstance->getFilesList($request); | |
echo "Expected response type is FilesList.", "<br />"; | |
foreach($response->getValue() as $storageFile) { | |
echo "Files: ", $storageFile->getPath(), "<br />"; | |
} | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$infoApi = GroupDocs\Merger\InfoApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/password-protected.docx"); | |
$fileInfo->setPassword("password"); | |
$response = $infoApi->getInfo(new Requests\getInfoRequest($fileInfo)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$infoApi = GroupDocs\Merger\InfoApi($configuration); | |
$response = $infoApi->getSupportedFileFormats(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo1 = new Model\FileInfo(); | |
$fileInfo1->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$item1 = new Model\JoinItem(); | |
$item1->setFileInfo($fileInfo1); | |
$item1->setPages([3, 6, 8]); | |
$fileInfo2 = new Model\FileInfo(); | |
$fileInfo2->setFilePath("WordProcessing/four-pages.docx"); | |
$item2 = new Model\JoinItem(); | |
$item2->setFileInfo($fileInfo2); | |
$item2->setStartPageNumber(1); | |
$item2->setEndPageNumber(4); | |
$item2->setRangeMode(Model\JoinItem::RANGE_MODE_ODD_PAGES); | |
$options = new Model\JoinOptions(); | |
$options->setJoinItems([$item1, $item2]); | |
$options->setOutputPath("Output/joined-pages.docx"); | |
$request = new Requests\joinRequest($options); | |
$response = $documentApi->join($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFileApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\MoveFileRequest("mergerdocs\one-page.docx", "mergerdocs1\one-page-copied.docx", CommonUtils::$MyStorage, CommonUtils::$MyStorage); | |
$apiInstance->moveFile($request); | |
echo "Expected response type is Void: 'mergerdocs/one-page.docx' file moved as 'mergerdocs1/one-page-copied.docx'."; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFolderApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\MoveFolderRequest("mergerdocs1", "mergerdocs1\\mergerdocs1", CommonUtils::$MyStorage, CommonUtils::$MyStorage, true); | |
$apiInstance->moveFolder($request); | |
echo "Expected response type is Void: 'mergerdocs1' folder moved to 'mergerdocs1/mergerdocs1'.", "<br />"; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/four-pages.docx"); | |
$options = new Model\MoveOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/move-pages.docx"); | |
$options->setPageNumber(1); | |
$options->setNewPageNumber(2); | |
$request = new Requests\moveRequest($options); | |
$response = $pagesApi->move($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetStorageApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\ObjectExistsRequest("mergerdocs\one-page.docx", CommonUtils::$MyStorage); | |
$response = $apiInstance->objectExists($request); | |
echo "Expected response type is ObjectExist: ", $response; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/four-pages.docx"); | |
$options = new Model\PreviewOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/preview-page"); | |
$options->setPages([1, 3]); | |
$options->setFormat(Model\PreviewOptions::FORMAT_PNG); | |
$request = new Requests\previewRequest($options); | |
$response = $documentApi->preview($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$securityApi = GroupDocs\Merger\SecurityApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/password-protected.docx"); | |
$fileInfo->setPassword("password"); | |
$options = new Model\Options(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/remove-password.docx"); | |
$request = new Requests\removePasswordRequest($options); | |
$response = $securityApi->removePassword($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/four-pages.docx"); | |
$options = new Model\RemoveOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/remove-pages.docx"); | |
$options->setPages([2, 4]); | |
$request = new Requests\removeRequest($options); | |
$response = $pagesApi->remove($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("Pdf/ten-pages.pdf"); | |
$options = new Model\RotateOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/rotate-pages.pdf"); | |
$options->setPages([2, 4]); | |
$options->setMode(Model\RotateOptions::MODE_ROTATE90); | |
$request = new Requests\rotateRequest($options); | |
$response = $pagesApi->rotate($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\SplitOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/split-to-multipage-document"); | |
$options->setPages([3, 6, 8]); | |
$options->setMode(Model\SplitOptions::MODE_INTERVALS); | |
$request = new Requests\splitRequest($options); | |
$response = $documentApi->split($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\SplitOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/split-document"); | |
$options->setPages([1, 3]); | |
$options->setMode(Model\SplitOptions::MODE_PAGES); | |
$request = new Requests\splitRequest($options); | |
$response = $documentApi->split($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\SplitOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/split-by-start-end-numbers"); | |
$options->setStartPageNumber(3); | |
$options->setEndPageNumber(7); | |
$options->setMode(Model\SplitOptions::MODE_PAGES); | |
$request = new Requests\splitRequest($options); | |
$response = $documentApi->split($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$documentApi = GroupDocs\Merger\DocumentApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/sample-10-pages.docx"); | |
$options = new Model\SplitOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/split-by-start-end-numbers-with-filter"); | |
$options->setStartPageNumber(3); | |
$options->setEndPageNumber(7); | |
$options->setRangeMode(Model\SplitOptions::RANGE_MODE_ODD_PAGES); | |
$options->setMode(Model\SplitOptions::MODE_PAGES); | |
$request = new Requests\splitRequest($options); | |
$response = $documentApi->split($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetStorageApiInstance(); | |
$request = new GroupDocs\Merger\Model\Requests\StorageExistsRequest(CommonUtils::$MyStorage); | |
$response = $apiInstance->storageExists($request); | |
echo "Expected response type is StorageExist: ", $response; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$pagesApi = GroupDocs\Merger\PagesApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/four-pages.docx"); | |
$options = new Model\SwapOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/swap-pages.docx"); | |
$options->setFirstPageNumber(2); | |
$options->setSecondPageNumber(4); | |
$request = new Requests\swapRequest($options); | |
$response = $pagesApi->swap($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = new GroupDocs\Merger\Configuration(); | |
$configuration->setAppSid(CommonUtils::$AppSid); | |
$configuration->setAppKey(CommonUtils::$AppKey); | |
$securityApi = GroupDocs\Merger\SecurityApi($configuration); | |
$fileInfo = new Model\FileInfo(); | |
$fileInfo->setFilePath("WordProcessing/password-protected.docx"); | |
$fileInfo->setPassword("password"); | |
$options = new Model\UpdatePasswordOptions(); | |
$options->setFileInfo($fileInfo); | |
$options->setOutputPath("Output/update-password.docx"); | |
$options->setNewPassword("NewPassword"); | |
$request = new Requests\updatePasswordRequest($options); | |
$response = $securityApi->updatePassword($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '\CommonUtils.php'); | |
try { | |
$apiInstance = CommonUtils::GetFileApiInstance(); | |
$filePath = realpath(dirname(__DIR__). '\Resources\mergerdocs\one-page.docx'); | |
echo "filePath: ". $filePath; | |
$fileStream = readfile($filePath); | |
$request = new GroupDocs\Merger\Model\Requests\UploadFileRequest("mergerdocs\one-page1.docx", $fileStream); | |
$response = $apiInstance->uploadFile($request); | |
echo "Expected response type is FilesUploadResult: ", $response; | |
} catch (Exception $e) { | |
echo "Something went wrong: ", $e->getMessage(), "\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment