426 19

Merge multiple PDFs using PHP SDK from Aspose

PHP developers can learn how to merge multiple PDF files into a single PDF file using PHP SDK from Aspose. You can use the following given supported third party storage to access Aspose for Cloud service.

In order to use PHP SDK, you need to perform following steps:

-	Set base product URI, App SID, App Key and output location. See section 1 of the complete code.
-	Upload input PDF files. See section 2 of the complete code.
-	Create object of Document class and call mergeDocuments method passing array of names (including paths) of input PDF files. See section 3 of the complete code.
-	Download merged PDF file. See Download a Particular File example for more details.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
use Aspose\Cloud\Common\AsposeApp; use Aspose\Cloud\Common\Utils; use Aspose\Cloud\Common\Product; use Aspose\Cloud\Storage\Folder; use Aspose\Cloud\Pdf\Document; /**** Section 1 ****/ AsposeApp::$appSID = "77****-****-****-****-80*********"; AsposeApp::$appKey = "******************"; $baseProductUri= ""; AsposeApp::$outPutLocation = getcwd() . "/Output/"; /**** End Section 1 ****/ /**** Section 2 ****/ $inputFile1 = getcwd() . "/Input/input1.pdf"; $inputFile2 = getcwd() . "/Input/input2.pdf"; $inputFile3 = getcwd() . "/Input/input3.pdf"; $mergedFileName = "MergedFile.pdf"; //upload input PDF files echo "Uploading main document...<br />"; $folder = new Folder(); $folder->UploadFile($inputFile1, ""); $folder->UploadFile($inputFile2, ""); $folder->UploadFile($inputFile3, ""); echo "input files uploaded <br />"; /**** End Section 2 ****/ /**** Section 3 ****/ echo "Merging PDF files... <br />"; //create Document object $doc = new Document($mergedFileName); $result = $doc->mergeDocuments(array('input1.pdf','input2.pdf','input3.pdf')); /**** End Section 3 ****/
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus