Пример #1
0
 //###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 {
     $response = $signatureApi->SignDocument($clientId, $settings);
     $iframe = "";
     //Check is file signed and uploaded successfully
     if ($response->status == "Ok") {
         sleep(5);
         try {
             $getDocumentStatus = $signatureApi->GetSignDocumentStatus($clientId, $response->result->jobId);
Пример #2
0
 //Create Doc Api object
 $docApi = new DocApi($apiClient);
 //Create Storage Api object
 $storageApi = new StorageApi($apiClient);
 //Create AsyncApi object
 $AsyncApi = new AsyncApi($apiClient);
 //Create MergeApi object
 $mergApi = new MergeApi($apiClient);
 //Create SignatureApi object
 $signature = new SignatureApi($apiClient);
 //Set base path for all Apis
 $docApi->setBasePath($basePath);
 $storageApi->setBasePath($basePath);
 $AsyncApi->setBasePath($basePath);
 $mergApi->setBasePath($basePath);
 $signature->setBasePath($basePath);
 try {
     //File for upload
     $file = $_FILES['file'];
     //Temp name of the file
     $tmpName = $file['tmp_name'];
     //Original name of the file
     $name = $file['name'];
     //Create file stream
     $fs = FileStream::fromFile($tmpName);
     //###Make a request to Storage API using clientId
     //Upload file to current user storage
     $uploadResult = $storageApi->Upload($clientId, $name, 'uploaded', "", 0, $fs);
     //###Check if file uploaded successfully
     if ($uploadResult->status == "Ok") {
         //Get file GUID