$signer->name = $fiSignature["name"]; $signer->data = "data:" . $fiSignature["type"] . ";base64," . base64_encode($signatureContent); $signer->height = 40; $signer->width = 100; $signer->top = 0.83319; $signer->left = 0.72171; $signer->email = "*****@*****.**"; //###Create Signer, ApiClient and Storage Api objects //Create signer object $signature = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signature); //Create Storage Api object $signatureApi = new SignatureApi($apiClient); //Create AsyncApi object $asyncApi = new AsyncApi($apiClient); //Check if user entered base path if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $signatureApi->setBasePath($basePath); $asyncApi->setBasePath($basePath); //Create setting variable for signature SignDocument method $settings = new SignatureSignDocumentSettingsInfo(); $settings->documents = array(get_object_vars($document)); $settings->signers = array(get_object_vars($signer)); //###Make a request to Signature Api for sign document //Sign document using current user id and sign settings try {
delFolder(__DIR__ . '/../downloads/'); } } F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Doc Api object $docApi = new DocApi($apiClient); //Create Storage Api object $apiStorage = new StorageApi($apiClient); //Create AsyncApi object $api = new AsyncApi($apiClient); $mergApi = new MergeApi($apiClient); $signatureApi = new SignatureApi($apiClient); //Set url to choose whot server to use if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $apiStorage->setBasePath($basePath); $api->setBasePath($basePath); $mergApi->setBasePath($basePath); $signatureApi->setBasePath($basePath); //Get entered by user data $name = F3::get('POST["name"]');
$userInfo = file(__DIR__ . '/../../user_info.txt'); //Get user data from text file $clientId = $userInfo[0]; $privateKey = $userInfo[1]; //Get raw data $json = file_get_contents("php://input"); //Decode json with raw data to array $callBack_data = json_decode($json, true); //Get job id from array $jobId = $callBack_data["SourceId"]; //Create signer object $signer = new GroupDocsRequestSigner(trim($privateKey)); //Create apiClient object $apiClient = new APIClient($signer); //Create AsyncApi object $asyncApi = new AsyncApi($apiClient); //Create Storage Api object $storageApi = new StorageApi($apiClient); sleep(5); //Make request to Async API to get job info $jobInfo = $asyncApi->GetJobDocuments(trim($clientId), $jobId, ""); if ($jobInfo->status == "Ok") { //Get file guid $guid = $jobInfo->result->inputs[0]->outputs[0]->guid; //Get file name $name = $jobInfo->result->inputs[0]->outputs[0]->name; } //Local path to the downloads folder $downloadFolder = dirname(__FILE__) . '/../../downloads'; //Check is folder exist if (!file_exists($downloadFolder)) {
if (empty($clientID) || empty($privateKey)) { throw new Exception('Please enter FILE ID'); } else { F3::set('userId', $clientID); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Doc Api object $docApi = new DocApi($apiClient); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Create AsyncApi object $asyncApi = new AsyncApi($apiClient); $mergApi = new MergeApi($apiClient); //Set url to choose whot server to use if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $storageApi->setBasePath($basePath); $asyncApi->setBasePath($basePath); $mergApi->setBasePath($basePath); //Get entered by user data $url = F3::get('POST["url"]'); $file = $_FILES['file']; $fileId = F3::get('POST["fileId"]');
//Get base path $basePath = F3::get('POST["basePath"]'); //Set variables for Viewer F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //Get entered by user data $url = F3::get('POST["url"]'); $file = $_FILES['file']; $fileId = F3::get('POST["fileId"]'); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create AsyncApi object $asyncApi = new AsyncApi($apiClient); //Create Storage Api object $storageApi = new StorageApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $asyncApi->setBasePath($basePath); $storageApi->setBasePath($basePath); //Check if user choose upload file from URL if ($url != "") { //Upload file from URL $uploadResult = $storageApi->UploadWeb($clientId, $url); //Check is file uploaded try {