/**** Section 1 ****/
$appSID = '77****-****-****-****-80*********';
$appKey = '****************';
//build URI to merge PDFs
$strURI = 'https://api.aspose.com/v1.1/pdf/MergedFile.pdf/merge';
//sign URI
$signedURI = sign($strURI, $appSID, $appKey);
/**** End Section 1 ****/
/**** Section 2 ****/
//Build JSON to post
$documentsList = array('List'=> array('input1.pdf', 'input2.pdf', 'input3.pdf');
$json = json_encode($documentsList);
/**** End Section 2 ****/
/**** Section 3 ****/
$responseStream = processCommand($signedURI, 'PUT', 'json', $json);
/**** End Section 3 ****/
/**** Section 4 ****/
//Download merged PDF
//build URI
$strURI = 'https://stage.aspose.com/v1.1/storage/file/MergedFile.pdf';
//sign URI
$signedURI = sign($strURI, $appSID, $appKey);
$responseStream = processCommand($signedURI, "GET", "", "");
$outputPath = getcwd() . '/output/MergedFile.pdf';
saveFile($responseStream, $outputPath);
echo 'Files have been merged and output file has been saved at: ' . $outputPath;
/**** End Section 4 ****/
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= "https://api.aspose.com/v1.1";
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 ****/
Copyright © 2024, NextGenUpdate.
All Rights Reserved.