//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); //Get file guid if ($getDocumentStatus->status == "Ok") { $guid = $getDocumentStatus->result->documents[0]->documentId; if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'http://apps.groupdocs.com/document-viewer/embed/' . $guid; //iframe to dev server } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") { $iframe = 'http://dev-apps.groupdocs.com/document-viewer/embed/' . $guid; //iframe to test server