Пример #1
0
     $field = new DatasourceField();
     //Set DatasourceFiled data
     $field->name = $fieldName;
     $field->type = "text";
     $field->values = array($data);
     //Push DatasourceField to array
     array_push($array, $field);
 }
 //Set array feilds array to the Datasourc
 $dataSource->fields = $array;
 //Add Datasource to GroupDocs
 $addDataSource = $mergApi->AddDataSource($clientId, $dataSource);
 //Check status
 if ($addDataSource->status == "Ok") {
     //If status ok merge Datasource to new pdf file
     $job = $mergApi->MergeDatasource($clientId, $templateGuid, $addDataSource->result->datasource_id, "pdf", null);
     //Check status
     if ($job->status == "Ok") {
         //### Check job status
         for ($n = 0; $n <= 5; $n++) {
             //Delay necessary that the inquiry would manage to be processed
             sleep(2);
             //Make request to api for get document info by job id
             $jobInfo = $api->GetJobDocuments($clientId, $job->result->job_id);
             //Check job status, if status is Completed or Archived exit from cycle
             if ($jobInfo->result->job_status == "Completed" || $jobInfo->result->job_status == "Archived") {
                 break;
                 //If job status Postponed throw exception with error
             } elseif ($jobInfo->result->job_status == "Postponed") {
                 throw new Exception("Job is failed");
             }
Пример #2
0
     $field = new DatasourceField();
     //Set DatasourceFiled data
     $field->name = $fieldName;
     $field->type = "text";
     $field->values = array($data);
     //Push DatasourceField to array
     array_push($array, $field);
 }
 //Set array feilds array to the Datasourc
 $dataSource->fields = $array;
 //Add Datasource to GroupDocs
 $addDataSource = $mergApi->AddDataSource($clientId, $dataSource);
 //Check status
 if ($addDataSource->status == "Ok") {
     //If status ok merge Datasource to new pdf file
     $job = $mergApi->MergeDatasource($clientId, $fileGuId, $addDataSource->result->datasource_id, $resultType, null);
     //Check status
     if ($job->status == "Ok") {
         //### Check job status
         for ($n = 0; $n <= 5; $n++) {
             //Delay necessary that the inquiry would manage to be processed
             sleep(2);
             //Make request to api for get document info by job id
             $jobInfo = $api->GetJobDocuments($clientId, $job->result->job_id);
             //Check job status, if status is Completed or Archived exit from cycle
             if ($jobInfo->result->job_status == "Completed" || $jobInfo->result->job_status == "Archived") {
                 break;
                 //If job status Postponed throw exception with error
             } elseif ($jobInfo->result->job_status == "Postponed") {
                 throw new Exception("Job is failed");
             }