} else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } if ($fileGuId != "") { $fileId = $fileGuId; } $annotationType = F3::get('POST["annotationType"]'); $replyText = F3::get('POST["text"]'); // Delete annotation if Delete Button clicked if (F3::get('POST["deleteAnnotation"]') == "1") { $antApi->DeleteAnnotation($clientId, F3::get('POST["annotationId"]')); } // Required parameters $allParams = array('annotationType', 'boxX', 'boxY', 'text'); // Added required parameters depends on annotation type ['type' or 'area'] if ($annotationType == "text") { $allParams = array_merge($allParams, array('boxWidth', 'boxHeight', 'annotationPositionX', 'annotationPositionY', 'rangePosition', 'rangeLength')); } elseif ($annotationType == "area") { $allParams = array_merge($allParams, array('boxWidth', 'boxHeight')); } // Checking required parameters foreach ($allParams as $param) { $needParam = F3::get('POST["' . $param . '"]'); if (!isset($needParam) or empty($needParam)) { throw new Exception('Please enter all required parameters'); }
# Create Annotation object $ant = new AntApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $ant->setBasePath($basePath); # Make a request to Annotation API using clientId and fileId $list = $ant->ListAnnotations($clientId, $fileId); $message = ""; // Check the result of the request if ($list->status == "Ok") { if (!empty($list->result->annotations)) { for ($i = 0; $i < count($list->result->annotations); $i++) { $del = $ant->DeleteAnnotation($clientId, $list->result->annotations[$i]->guid); if ($del->status == "Ok") { $message = '<span style="color: green">All annotation were deleted successfully</span>'; //### If request was successfull //Generation of iframe URL using $pageImage->result->guid //iframe to prodaction server if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'https://apps.groupdocs.com/document-viewer/embed/' . $fileId; //iframe to dev server } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") { $iframe = 'https://dev-apps.groupdocs.com/document-viewer/embed/' . $fileId; //iframe to test server } elseif ($basePath == "https://stage-api-groupdocs.dynabic.com/v2.0") { $iframe = 'https://stage-apps-groupdocs.dynabic.com/document-viewer/embed/' . $fileId; } elseif ($basePath == "http://realtime-api.groupdocs.com") { $iframe = 'http://realtime-apps.groupdocs.com/document-viewer/embed/' . $fileId;